Local_Name_Space.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Local_Name_Space.h
00006  *
00007  *  Local_Name_Space.h,v 4.28 2005/10/28 16:14:52 ossama Exp
00008  *
00009  *  @author Prashant Jain (pjain@cs.wustl.edu)
00010  *  @author Irfan Pyarali (irfan@wuerl.wustl.edu)
00011  *  @author Douglas C. Schmidt (schmidt@cs.wustl.edu).
00012  */
00013 //=============================================================================
00014 
00015 #ifndef ACE_LOCAL_NAME_SPACE_H
00016 #define ACE_LOCAL_NAME_SPACE_H
00017 
00018 #include /**/ "ace/pre.h"
00019 
00020 #include "ace/Malloc_T.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00027 
00028 class ACE_NS_WString;
00029 
00030 /**
00031  * @class ACE_NS_String
00032  *
00033  * @brief This class and ACE_NS_Internal are used as Adapters to work
00034  * with the Map_Manager.
00035  *
00036  * In order to work correctly, this class must be able to
00037  * convert back and forth with <ACE_NS_WStrings>.
00038  */
00039 class ACE_Export ACE_NS_String
00040 {
00041 public:
00042   // = Initialization.
00043   /// Default "no-op" constructor.
00044   ACE_NS_String (void);
00045 
00046   /// Initialization method.
00047   ACE_NS_String (ACE_WCHAR_T *dst,
00048                  const ACE_WCHAR_T *src,
00049                  size_t len);
00050 
00051   /// Converts an ACE_NS_WString to an ACE_NS_String;
00052   ACE_NS_String (const ACE_NS_WString &);
00053 
00054   /// Destructor
00055   ~ACE_NS_String (void);
00056 
00057   /// Converts an ACE_NS_String to fresh copy of an ACE_NS_WString;
00058   operator ACE_NS_WString () const;
00059 
00060   /// Return the ASCII character representation.
00061   char *char_rep (void) const;
00062 
00063   /// Matches on substrings.
00064   int strstr (const ACE_NS_String &) const;
00065 
00066   /// Compare an ACE_NS_String.
00067   bool operator == (const ACE_NS_String &) const;
00068 
00069   /// Compare an ACE_NS_String.
00070   bool operator != (const ACE_NS_String &) const;
00071 
00072   /// Returns length of the string
00073   size_t len (void) const;
00074 
00075   /// Returns the underlying representation.
00076   ACE_WCHAR_T *fast_rep (void) const;
00077 
00078   /// Returns a hash value for this string.
00079   u_long hash (void) const;
00080 
00081 private:
00082   /// Length of the string.
00083   size_t len_;
00084 
00085   /// This actually points into shared/persistent memory.
00086   ACE_WCHAR_T *rep_;
00087 
00088   /// Should rep_ be deleted when destructed (only used
00089   /// for WString conversions)
00090   int delete_rep_;
00091 };
00092 
00093 /**
00094  * @class ACE_NS_Internal
00095  *
00096  * @brief This class and ACE_NS_String are used as Adapters to work
00097  * with the Map_Manager.
00098  */
00099 class ACE_Export ACE_NS_Internal
00100 {
00101 public:
00102   /// No-op constructor.
00103   ACE_NS_Internal (void);
00104 
00105   /// Constructor.
00106   ACE_NS_Internal (ACE_NS_String &value, const char *type);
00107 
00108   /// Compare an ACE_NS_Internal
00109   bool operator == (const ACE_NS_Internal &) const;
00110 
00111   /// Return value.
00112   ACE_NS_String value (void);
00113 
00114   /// Return type.
00115   const char *type (void);
00116 
00117 private:
00118   /// Contains the value of the string.
00119   ACE_NS_String value_;
00120 
00121   /// Contains the type of the string.
00122   const char *type_;
00123 };
00124 
00125 ACE_END_VERSIONED_NAMESPACE_DECL
00126 
00127 // Include the ACE_Local_Name_Space templates stuff at this point.
00128 #include "ace/Local_Name_Space_T.h"
00129 
00130 #include /**/ "ace/post.h"
00131 
00132 #endif /* ACE_LOCAL_NAME_SPACE_H */

Generated on Thu Nov 9 09:41:53 2006 for ACE by doxygen 1.3.6