*Backed out changeset 3be01fb200a5
--HG-- branch : trunk
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/* -*- C++ -*- */
|
||||
|
||||
//=============================================================================
|
||||
/**
|
||||
* @file Capabilities.h
|
||||
@@ -9,23 +10,30 @@
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
|
||||
#ifndef ACE_CAPABILITIES_H
|
||||
#define ACE_CAPABILITIES_H
|
||||
#include /**/ "ace/pre.h"
|
||||
|
||||
#include /**/ "ace/config-all.h"
|
||||
|
||||
#if !defined (ACE_LACKS_PRAGMA_ONCE)
|
||||
# pragma once
|
||||
#endif /* ACE_LACKS_PRAGMA_ONCE */
|
||||
|
||||
#include "ace/Null_Mutex.h"
|
||||
#include "ace/Hash_Map_Manager_T.h"
|
||||
#include "ace/Containers.h"
|
||||
#include "ace/SString.h"
|
||||
#include "ace/Functor_String.h"
|
||||
|
||||
#if defined (ACE_IS_SPLITTING)
|
||||
# include "ace/OS_NS_ctype.h"
|
||||
#endif /* ACE_IS_SPLITTING */
|
||||
|
||||
|
||||
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
/**
|
||||
* @class ACE_CapEntry
|
||||
*
|
||||
@@ -39,18 +47,26 @@ ACE_BEGIN_VERSIONED_NAMESPACE_DECL
|
||||
class ACE_Export ACE_CapEntry
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~ACE_CapEntry (void);
|
||||
|
||||
protected:
|
||||
|
||||
enum
|
||||
{
|
||||
ACE_INTCAP = 0,
|
||||
ACE_STRINGCAP = 1,
|
||||
ACE_BOOLCAP = 2
|
||||
};
|
||||
|
||||
ACE_CapEntry (int captype);
|
||||
|
||||
protected:
|
||||
|
||||
int captype_;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ACE_IntCapEntry
|
||||
*
|
||||
@@ -64,9 +80,11 @@ class ACE_Export ACE_IntCapEntry : public ACE_CapEntry
|
||||
public:
|
||||
ACE_IntCapEntry (int val);
|
||||
int getval (void) const;
|
||||
|
||||
protected:
|
||||
int val_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ACE_StringCapEntry
|
||||
*
|
||||
@@ -80,9 +98,11 @@ class ACE_Export ACE_StringCapEntry : public ACE_CapEntry
|
||||
public:
|
||||
ACE_StringCapEntry (const ACE_TString &val);
|
||||
ACE_TString getval (void) const;
|
||||
|
||||
protected:
|
||||
ACE_TString val_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ACE_BoolCapEntry
|
||||
*
|
||||
@@ -96,9 +116,11 @@ class ACE_Export ACE_BoolCapEntry : public ACE_CapEntry
|
||||
public:
|
||||
ACE_BoolCapEntry (int val);
|
||||
int getval (void) const;
|
||||
|
||||
protected:
|
||||
int val_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @class ACE_Capabilities
|
||||
*
|
||||
@@ -117,59 +139,84 @@ protected:
|
||||
class ACE_Export ACE_Capabilities
|
||||
{
|
||||
public:
|
||||
|
||||
typedef ACE_Hash_Map_Manager_Ex<ACE_TString, ACE_CapEntry *, ACE_Hash<ACE_TString>, ACE_Equal_To<ACE_TString>, ACE_Null_Mutex> CAPABILITIES_MAP;
|
||||
|
||||
/// The Constructor
|
||||
ACE_Capabilities (void);
|
||||
|
||||
/// The Destructor
|
||||
~ACE_Capabilities(void);
|
||||
|
||||
public:
|
||||
|
||||
/// Get a string entry.
|
||||
int getval (const ACE_TCHAR *ent, ACE_TString &val);
|
||||
|
||||
/// Get an integer entry.
|
||||
int getval (const ACE_TCHAR *ent, int &val);
|
||||
|
||||
/// Get the ACE_Capabilities name from FILE fname and load the
|
||||
/// associated capabitily entries in map.
|
||||
int getent (const ACE_TCHAR *fname, const ACE_TCHAR *name);
|
||||
|
||||
protected:
|
||||
|
||||
/// Parse an integer property
|
||||
const ACE_TCHAR *parse (const ACE_TCHAR *buf, int &cap);
|
||||
|
||||
/// Parse a string property
|
||||
const ACE_TCHAR *parse (const ACE_TCHAR *buf, ACE_TString &cap);
|
||||
|
||||
/// Fill the ACE_Capabilities with description in ent.
|
||||
int fillent(const ACE_TCHAR *ent);
|
||||
|
||||
/// Parse a cap entry
|
||||
int parseent (const ACE_TCHAR *name, ACE_TCHAR *line);
|
||||
|
||||
/// Get a line from FILE input stream
|
||||
int getline (FILE* fp,
|
||||
ACE_TString &line);
|
||||
|
||||
/// Is a valid entry
|
||||
int is_entry (const ACE_TCHAR *name, const ACE_TCHAR *line);
|
||||
|
||||
/// Reset the set of capabilities
|
||||
void resetcaps (void);
|
||||
|
||||
private:
|
||||
|
||||
/// This is the set of ACE_CapEntry.
|
||||
CAPABILITIES_MAP caps_;
|
||||
|
||||
};
|
||||
|
||||
#if defined (ACE_IS_SPLITTING)
|
||||
int
|
||||
is_empty (const ACE_TCHAR *line)
|
||||
{
|
||||
while (*line && ACE_OS::ace_isspace (*line))
|
||||
++line;
|
||||
|
||||
return *line == ACE_TEXT ('\0') || *line == ACE_TEXT ('#');
|
||||
}
|
||||
|
||||
int
|
||||
is_line (const ACE_TCHAR *line)
|
||||
{
|
||||
while (*line && ACE_OS::ace_isspace (*line))
|
||||
++line;
|
||||
|
||||
return *line != ACE_TEXT ('\0');
|
||||
}
|
||||
#endif /* ACE_IS_SPLITTING */
|
||||
|
||||
ACE_END_VERSIONED_NAMESPACE_DECL
|
||||
|
||||
#if defined (__ACE_INLINE__)
|
||||
#include "ace/Capabilities.inl"
|
||||
#endif /* __ACE_INLINE__ */
|
||||
|
||||
#include /**/ "ace/post.h"
|
||||
#endif /* __ACE_CAPABILITIES_H__ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user