Operator Console
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Public Attributes | List of all members
json_shared_string Class Reference

#include <JSONSharedString.h>

Classes

struct  json_shared_string_internal
 

Public Member Functions

json_string::iterator begin (void)
 
json_string::iterator end (void)
 
json_string::const_iterator begin (void) const
 
json_string::const_iterator end (void) const
 
 json_shared_string (void)
 
 json_shared_string (const json_string &str)
 
 json_shared_string (const json_shared_string &str, size_t _offset, size_t _len)
 
 json_shared_string (const json_shared_string &str, size_t _offset)
 
 ~json_shared_string (void)
 
bool empty (void) const
 
size_t find (json_char ch, size_t pos=0) const
 
json_charoperator[] (size_t loc)
 
json_char operator[] (size_t loc) const
 
void clear ()
 
size_t length () const
 
const json_charc_str () const
 
const json_chardata () const
 
bool operator!= (const json_shared_string &other) const
 
bool operator== (const json_shared_string &other) const
 
bool operator== (const json_string &other) const
 
json_string & toString (void) const
 
void assign (const json_shared_string &other, size_t _offset, size_t _len)
 
 json_shared_string (const json_shared_string &other)
 
json_shared_stringoperator= (const json_shared_string &other)
 
void deref (void)
 
size_t offset PACKED (20)
 
size_t len PACKED (20)
 
json_string::iterator begin (void)
 
json_string::iterator end (void)
 
json_string::const_iterator begin (void) const
 
json_string::const_iterator end (void) const
 
 json_shared_string (void)
 
 json_shared_string (const json_string &str)
 
 json_shared_string (const json_shared_string &str, size_t _offset, size_t _len)
 
 json_shared_string (const json_shared_string &str, size_t _offset)
 
 ~json_shared_string (void)
 
bool empty (void) const
 
size_t find (json_char ch, size_t pos=0) const
 
json_charoperator[] (size_t loc)
 
json_char operator[] (size_t loc) const
 
void clear ()
 
size_t length () const
 
const json_charc_str () const
 
const json_chardata () const
 
bool operator!= (const json_shared_string &other) const
 
bool operator== (const json_shared_string &other) const
 
bool operator== (const json_string &other) const
 
json_string & toString (void) const
 
void assign (const json_shared_string &other, size_t _offset, size_t _len)
 
 json_shared_string (const json_shared_string &other)
 
json_shared_stringoperator= (const json_shared_string &other)
 
void deref (void)
 
size_t offset PACKED (20)
 
size_t len PACKED (20)
 

Public Attributes

json_shared_string_internal_str
 

Constructor & Destructor Documentation

json_shared_string::json_shared_string ( void  )
inline
41 : offset(0), len(0), _str(new json_shared_string_internal(json_global(EMPTY_JSON_STRING))) {}
#define json_global(NAME)
Definition: JSONGlobals.h:26
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_shared_string::json_shared_string ( const json_string &  str)
inline
43 : offset(0), len(str.length()), _str(new json_shared_string_internal(str)) {}
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_shared_string::json_shared_string ( const json_shared_string str,
size_t  _offset,
size_t  _len 
)
inline

References _str.

45  : _str(str._str), offset(str.offset + _offset), len(_len) {
46  ++_str -> refCount;
47  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_shared_string::json_shared_string ( const json_shared_string str,
size_t  _offset 
)
inline

References _str.

49  : _str(str._str), offset(str.offset + _offset), len(str.len - _offset) {
50  ++_str -> refCount;
51  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_shared_string::~json_shared_string ( void  )
inline

References deref().

53  {
54  deref();
55  }
void deref(void)
Definition: JSONSharedString.h:138

Here is the call graph for this function:

json_shared_string::json_shared_string ( const json_shared_string other)
inline

References _str.

118  : _str(other._str), offset(other.offset), len(other.len){
119  ++_str -> refCount;
120  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_shared_string::json_shared_string ( void  )
inline
41 : offset(0), len(0), _str(new json_shared_string_internal(json_global(EMPTY_JSON_STRING))) {}
#define json_global(NAME)
Definition: JSONGlobals.h:26
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_shared_string::json_shared_string ( const json_string &  str)
inline
43 : offset(0), len(str.length()), _str(new json_shared_string_internal(str)) {}
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_shared_string::json_shared_string ( const json_shared_string str,
size_t  _offset,
size_t  _len 
)
inline

References _str.

45  : _str(str._str), offset(str.offset + _offset), len(_len) {
46  ++_str -> refCount;
47  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_shared_string::json_shared_string ( const json_shared_string str,
size_t  _offset 
)
inline

References _str.

49  : _str(str._str), offset(str.offset + _offset), len(str.len - _offset) {
50  ++_str -> refCount;
51  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_shared_string::~json_shared_string ( void  )
inline

References deref().

53  {
54  deref();
55  }
void deref(void)
Definition: JSONSharedString.h:138

Here is the call graph for this function:

json_shared_string::json_shared_string ( const json_shared_string other)
inline

References _str.

118  : _str(other._str), offset(other.offset), len(other.len){
119  ++_str -> refCount;
120  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Member Function Documentation

void json_shared_string::assign ( const json_shared_string other,
size_t  _offset,
size_t  _len 
)
inline

References _str, and deref().

108  {
109  if (other._str != _str){
110  deref();
111  _str = other._str;
112  }
113  ++_str -> refCount;
114  offset = other.offset + _offset;
115  len = _len;
116  }
void deref(void)
Definition: JSONSharedString.h:138
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

void json_shared_string::assign ( const json_shared_string other,
size_t  _offset,
size_t  _len 
)
inline

References _str, and deref().

108  {
109  if (other._str != _str){
110  deref();
111  _str = other._str;
112  }
113  ++_str -> refCount;
114  offset = other.offset + _offset;
115  len = _len;
116  }
void deref(void)
Definition: JSONSharedString.h:138
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

json_string::iterator json_shared_string::begin ( void  )
inline

References _str.

Referenced by end(), find(), and toString().

27  {
28  return _str -> mystring.begin() + offset;
29  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the caller graph for this function:

json_string::iterator json_shared_string::begin ( void  )
inline

References _str.

27  {
28  return _str -> mystring.begin() + offset;
29  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_string::const_iterator json_shared_string::begin ( void  ) const
inline

References _str.

34  {
35  return _str -> mystring.begin() + offset;
36  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_string::const_iterator json_shared_string::begin ( void  ) const
inline

References _str.

34  {
35  return _str -> mystring.begin() + offset;
36  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
const json_char* json_shared_string::c_str ( ) const
inline

References toString().

76 { return toString().c_str(); }
json_string & toString(void) const
Definition: JSONSharedString.h:93

Here is the call graph for this function:

const json_char* json_shared_string::c_str ( ) const
inline

References toString().

76 { return toString().c_str(); }
json_string & toString(void) const
Definition: JSONSharedString.h:93

Here is the call graph for this function:

void json_shared_string::clear ( void  )
inline
74 { len = 0; }
void json_shared_string::clear ( void  )
inline
74 { len = 0; }
const json_char* json_shared_string::data ( ) const
inline

References _str.

77 { return _str -> mystring.c_str() + offset; }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
const json_char* json_shared_string::data ( ) const
inline

References _str.

77 { return _str -> mystring.c_str() + offset; }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
void json_shared_string::deref ( void  )
inline

References _str.

Referenced by assign(), operator=(), and ~json_shared_string().

138  {
139  if (--_str -> refCount == 0){
140  delete _str;
141  }
142  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the caller graph for this function:

void json_shared_string::deref ( void  )
inline

References _str.

138  {
139  if (--_str -> refCount == 0){
140  delete _str;
141  }
142  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
bool json_shared_string::empty ( void  ) const
inline
57 { return len == 0; }
bool json_shared_string::empty ( void  ) const
inline
57 { return len == 0; }
json_string::iterator json_shared_string::end ( void  )
inline

References begin().

Referenced by find(), and toString().

30  {
31  return begin() + len;
32  }
json_string::iterator begin(void)
Definition: JSONSharedString.h:27

Here is the call graph for this function:

Here is the caller graph for this function:

json_string::iterator json_shared_string::end ( void  )
inline

References begin().

30  {
31  return begin() + len;
32  }
json_string::iterator begin(void)
Definition: JSONSharedString.h:27

Here is the call graph for this function:

json_string::const_iterator json_shared_string::end ( void  ) const
inline

References begin().

37  {
38  return begin() + len;
39  }
json_string::iterator begin(void)
Definition: JSONSharedString.h:27

Here is the call graph for this function:

json_string::const_iterator json_shared_string::end ( void  ) const
inline

References begin().

37  {
38  return begin() + len;
39  }
json_string::iterator begin(void)
Definition: JSONSharedString.h:27

Here is the call graph for this function:

size_t json_shared_string::find ( json_char  ch,
size_t  pos = 0 
) const
inline

References _str, begin(), and end().

59  {
60  if (_str -> refCount == 1) return _str -> mystring.find(ch, pos);
61  json_string::const_iterator e = end();
62  for(json_string::const_iterator b = begin() + pos; b != e; ++b){
63  if (*b == ch) return b - begin();
64  }
65  return json_string::npos;
66  }
json_string::iterator begin(void)
Definition: JSONSharedString.h:27
json_string::iterator end(void)
Definition: JSONSharedString.h:30
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

size_t json_shared_string::find ( json_char  ch,
size_t  pos = 0 
) const
inline

References _str, begin(), and end().

59  {
60  if (_str -> refCount == 1) return _str -> mystring.find(ch, pos);
61  json_string::const_iterator e = end();
62  for(json_string::const_iterator b = begin() + pos; b != e; ++b){
63  if (*b == ch) return b - begin();
64  }
65  return json_string::npos;
66  }
json_string::iterator begin(void)
Definition: JSONSharedString.h:27
json_string::iterator end(void)
Definition: JSONSharedString.h:30
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

size_t json_shared_string::length ( ) const
inline
75 { return len; }
size_t json_shared_string::length ( ) const
inline
75 { return len; }
bool json_shared_string::operator!= ( const json_shared_string other) const
inline

References _str, and toString().

79  {
80  if ((other._str == _str) && (other.len == len) && (other.offset == offset)) return false;
81  return other.toString() != toString();
82  }
json_string & toString(void) const
Definition: JSONSharedString.h:93
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

bool json_shared_string::operator!= ( const json_shared_string other) const
inline

References _str, and toString().

79  {
80  if ((other._str == _str) && (other.len == len) && (other.offset == offset)) return false;
81  return other.toString() != toString();
82  }
json_string & toString(void) const
Definition: JSONSharedString.h:93
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

json_shared_string& json_shared_string::operator= ( const json_shared_string other)
inline

References _str, and deref().

122  {
123  if (other._str != _str){
124  deref();
125  _str = other._str;
126  }
127  ++_str -> refCount;
128  offset = other.offset;
129  len = other.len;
130  return *this;
131  }
void deref(void)
Definition: JSONSharedString.h:138
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

json_shared_string& json_shared_string::operator= ( const json_shared_string other)
inline

References _str, and deref().

122  {
123  if (other._str != _str){
124  deref();
125  _str = other._str;
126  }
127  ++_str -> refCount;
128  offset = other.offset;
129  len = other.len;
130  return *this;
131  }
void deref(void)
Definition: JSONSharedString.h:138
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

bool json_shared_string::operator== ( const json_shared_string other) const
inline

References _str, and toString().

84  {
85  if ((other._str == _str) && (other.len == len) && (other.offset == offset)) return true;
86  return other.toString() == toString();
87  }
json_string & toString(void) const
Definition: JSONSharedString.h:93
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

bool json_shared_string::operator== ( const json_shared_string other) const
inline

References _str, and toString().

84  {
85  if ((other._str == _str) && (other.len == len) && (other.offset == offset)) return true;
86  return other.toString() == toString();
87  }
json_string & toString(void) const
Definition: JSONSharedString.h:93
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

bool json_shared_string::operator== ( const json_string &  other) const
inline

References toString().

89  {
90  return other == toString();
91  }
json_string & toString(void) const
Definition: JSONSharedString.h:93
A struct that can be used to catch other (that is, not Blemish, OIS, or SFRplus) pass/fail categories...
Definition: PassFailSettings.h:192

Here is the call graph for this function:

bool json_shared_string::operator== ( const json_string &  other) const
inline

References toString().

89  {
90  return other == toString();
91  }
json_string & toString(void) const
Definition: JSONSharedString.h:93
A struct that can be used to catch other (that is, not Blemish, OIS, or SFRplus) pass/fail categories...
Definition: PassFailSettings.h:192

Here is the call graph for this function:

json_char& json_shared_string::operator[] ( size_t  loc)
inline

References _str.

68  {
69  return _str -> mystring[loc + offset];
70  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_char& json_shared_string::operator[] ( size_t  loc)
inline

References _str.

68  {
69  return _str -> mystring[loc + offset];
70  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_char json_shared_string::operator[] ( size_t  loc) const
inline

References _str.

71  {
72  return _str -> mystring[loc + offset];
73  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
json_char json_shared_string::operator[] ( size_t  loc) const
inline

References _str.

71  {
72  return _str -> mystring[loc + offset];
73  }
json_shared_string_internal * _str
Definition: JSONSharedString.h:143
size_t offset json_shared_string::PACKED ( 20  )
mutable
size_t offset json_shared_string::PACKED ( 20  )
mutable
size_t len json_shared_string::PACKED ( 20  )
mutable
size_t len json_shared_string::PACKED ( 20  )
mutable
json_string& json_shared_string::toString ( void  ) const
inline

References _str, begin(), and end().

Referenced by c_str(), operator!=(), and operator==().

93  {
94  //gonna have to do a real substring now anyway, so do it completely
95  if (_str -> refCount == 1){
96  if (offset || len != _str -> mystring.length()){
97  _str -> mystring = json_string(begin(), end());
98  }
99  } else if (offset || len != _str -> mystring.length()){
100  --_str -> refCount; //dont use deref because I know its not going to be deleted
101  _str = new json_shared_string_internal(json_string(begin(), end()));
102  }
103  offset = 0;
104  return _str -> mystring;
105  }
json_string::iterator begin(void)
Definition: JSONSharedString.h:27
json_string::iterator end(void)
Definition: JSONSharedString.h:30
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

Here is the caller graph for this function:

json_string& json_shared_string::toString ( void  ) const
inline

References _str, begin(), and end().

93  {
94  //gonna have to do a real substring now anyway, so do it completely
95  if (_str -> refCount == 1){
96  if (offset || len != _str -> mystring.length()){
97  _str -> mystring = json_string(begin(), end());
98  }
99  } else if (offset || len != _str -> mystring.length()){
100  --_str -> refCount; //dont use deref because I know its not going to be deleted
101  _str = new json_shared_string_internal(json_string(begin(), end()));
102  }
103  offset = 0;
104  return _str -> mystring;
105  }
json_string::iterator begin(void)
Definition: JSONSharedString.h:27
json_string::iterator end(void)
Definition: JSONSharedString.h:30
json_shared_string_internal * _str
Definition: JSONSharedString.h:143

Here is the call graph for this function:

Member Data Documentation

json_shared_string_internal * json_shared_string::_str
mutable

The documentation for this class was generated from the following file: