ASN1C C/C++ Common Runtime  ASN1C v7.5.x
OSRTString.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2003-2021 Objective Systems, Inc.
3  *
4  * This software is furnished under a license and may be used and copied
5  * only in accordance with the terms of such license and with the
6  * inclusion of the above copyright notice. This software or any other
7  * copies thereof may not be provided or otherwise made available to any
8  * other person. No title to and ownership of the software is hereby
9  * transferred.
10  *
11  * The information in this software is subject to change without notice
12  * and should not be construed as a commitment by Objective Systems, Inc.
13  *
14  * PROPRIETARY NOTICE
15  *
16  * This software is an unpublished work subject to a confidentiality agreement
17  * and is protected by copyright and trade secret law. Unauthorized copying,
18  * redistribution or other use of this work is prohibited.
19  *
20  * The above notice of copyright on this source code product does not indicate
21  * any actual or intended publication of such source code.
22  *
23  *****************************************************************************/
31 #ifndef _OSRTSTRING_H_
32 #define _OSRTSTRING_H_
33 
34 /* Disable MS VC++ Level 4 warning about unreferenced inline functions */
35 #ifdef _MSC_VER
36 #pragma warning(disable: 4514)
37 #endif /* _MSC_VER */
38 
39 #include "rtxsrc/rtxCommon.h"
40 #include "rtxsrc/rtxPrint.h"
41 #include "rtxsrc/OSRTStringIF.h"
42 
49 class EXTRTCLASS OSRTString : public OSRTStringIF {
50  protected:
51  char* mpValue;
52 
53  public:
57  OSRTString();
58 
65  OSRTString (const char* strval);
66 
73  OSRTString (const OSUTF8CHAR* strval);
74 
80  OSRTString (const OSRTString& str);
81 
86  virtual ~OSRTString();
87 
91  virtual OSRTStringIF* clone() { return new OSRTString (*this); }
92 
96  inline const char* data() const { return getValue(); }
97 
102  virtual const char* getValue() const {
103  return mpValue;
104  }
105 
110  virtual const OSUTF8CHAR* getUTF8Value() const {
111  return (const OSUTF8CHAR*)mpValue;
112  }
113 
118  int indexOf (char ch) const;
119 
123  inline size_t length() const { return OSCRTLSTRLEN(mpValue); }
124 
130  virtual void print (const char* name) {
131  rtxPrintCharStr (name, mpValue);
132  }
133 
139  virtual EXTRTMETHOD void setValue (const char* strval);
140 
146  virtual EXTRTMETHOD void setValue (const OSUTF8CHAR* strval);
147 
155  virtual EXTRTMETHOD void setValuePtr (char* strval);
156 
157  // Integer conversion methods - return value is TRUE if conversion
158  // successful or FALSE otherwise..
165  bool toInt (OSINT32& value) const;
166 
173  bool toSize (OSSIZE& value) const;
174 
181  bool toUInt (OSUINT32& value) const;
182 
183 #if !defined(_NO_INT64_SUPPORT)
184 
190  bool toUInt64 (OSUINT64& value) const;
191 #endif
192 
196  EXTRTMETHOD OSRTString& operator= (const OSRTString& original);
197 
198  inline operator const char* (void) const {
199  return getValue();
200  }
201 } ;
202 
203 #endif
void rtxPrintCharStr(const char *name, const char *cstring)
const char * data() const
Definition: OSRTString.h:96
virtual OSRTStringIF * clone()
Definition: OSRTString.h:91
virtual void print(const char *name)
Definition: OSRTString.h:130
virtual const OSUTF8CHAR * getUTF8Value() const
Definition: OSRTString.h:110
Definition: OSRTString.h:49
size_t length() const
Definition: OSRTString.h:123
virtual const char * getValue() const
Definition: OSRTString.h:102