#include <Object_KeyC.h>
Inheritance diagram for TAO::ObjectKey:
Public Types | |
typedef ObjectKey_var | _var_type |
Public Member Functions | |
ObjectKey (void) | |
ObjectKey (CORBA::ULong max) | |
ObjectKey (CORBA::ULong max, CORBA::ULong length, CORBA::Octet *buffer, CORBA::Boolean release=false) | |
ObjectKey (const ObjectKey &) | |
~ObjectKey (void) | |
ObjectKey (CORBA::ULong length, const ACE_Message_Block *mb) | |
Static Public Member Functions | |
void | encode_sequence_to_string (char *&str, const TAO::unbounded_value_sequence< CORBA::Octet > &seq) |
void | decode_string_to_sequence (TAO::unbounded_value_sequence< CORBA::Octet > &seq, const char *str) |
int | is_legal (u_char &c) |
CORBA::Boolean | demarshal_key (ObjectKey &key, TAO_InputCDR &cdr) |
|
Definition at line 110 of file Object_KeyC.h. |
|
Definition at line 61 of file Object_KeyC.cpp.
00062 {} |
|
Definition at line 64 of file Object_KeyC.cpp.
00067 : TAO::unbounded_value_sequence< 00068 CORBA::Octet 00069 > 00070 (max) 00071 {} |
|
Definition at line 73 of file Object_KeyC.cpp.
00079 : TAO::unbounded_value_sequence< 00080 CORBA::Octet 00081 > 00082 (max, length, buffer, release) 00083 {} |
|
Definition at line 85 of file Object_KeyC.cpp.
00088 : TAO::unbounded_value_sequence< 00089 CORBA::Octet 00090 > 00091 (seq) 00092 {} |
|
Definition at line 94 of file Object_KeyC.cpp.
00095 {} |
|
Definition at line 113 of file Object_KeyC.h.
00117 : TAO::unbounded_value_sequence<CORBA::Octet> (length, mb) {} |
|
Definition at line 153 of file Object_KeyC.cpp. References ACE::hex2byte(), TAO::unbounded_value_sequence< T >::length(), and ACE_OS::strlen(). Referenced by TAO_IIOP_Profile::parse_string_i().
00155 { 00156 if (str == 0) 00157 { 00158 seq.length (0); 00159 return; 00160 } 00161 00162 size_t length = ACE_OS::strlen (str); 00163 const char *eos = str + length; 00164 const char *cp = str; 00165 00166 // Set the length of the sequence to be as long as 00167 // we'll possibly need...we'll reset it to the actual 00168 // length later. 00169 seq.length (length); 00170 00171 u_int i = 0; 00172 for (; 00173 cp < eos && i < seq.length (); 00174 ++i) 00175 { 00176 if (*cp == '%' || *cp == '\\') 00177 { 00178 // This is an escaped non-printable, 00179 // so we decode the hex values into 00180 // the sequence's octet 00181 seq[i] = (u_char) (ACE::hex2byte (cp[1]) << 4); 00182 seq[i] |= (u_char) ACE::hex2byte (cp[2]); 00183 cp += 3; 00184 } 00185 else 00186 // Copy it in 00187 seq[i] = *cp++; 00188 } 00189 00190 // Set the length appropriately 00191 seq.length (i); 00192 } |
|
A special method that gives no regard to how the ORB has configured the resource factory. This will be used only during Profile decoding and should be safe. This is a solution for the bug report [BUG 1616] Definition at line 195 of file Object_KeyC.cpp. References ACE_BIT_DISABLED, ACE_Message_Block::flags(), TAO::unbounded_value_sequence< T >::get_buffer(), TAO::unbounded_value_sequence< T >::length(), ACE_InputCDR::length(), ACE_InputCDR::read_octet_array(), TAO::unbounded_value_sequence< T >::replace(), ACE_InputCDR::skip_bytes(), and ACE_InputCDR::start(). Referenced by TAO_Profile::decode().
00197 { 00198 CORBA::ULong _tao_seq_len; 00199 00200 if (strm >> _tao_seq_len) 00201 { 00202 // Add a check to the length of the sequence 00203 // to make sure it does not exceed the length 00204 // of the stream. (See bug 58.) 00205 if (_tao_seq_len > strm.length ()) 00206 { 00207 return 0; 00208 } 00209 00210 // Set the length of the sequence. 00211 key.length (_tao_seq_len); 00212 00213 // If length is 0 we return true. 00214 if (0 >= _tao_seq_len) 00215 { 00216 return 1; 00217 } 00218 00219 // Retrieve all the elements. 00220 #if (TAO_NO_COPY_OCTET_SEQUENCES == 1) 00221 if (ACE_BIT_DISABLED (strm.start ()->flags (), 00222 ACE_Message_Block::DONT_DELETE)) 00223 { 00224 key.replace (_tao_seq_len, strm.start ()); 00225 key.mb ()->wr_ptr (key.mb()->rd_ptr () + _tao_seq_len); 00226 strm.skip_bytes (_tao_seq_len); 00227 return 1; 00228 } 00229 return strm.read_octet_array (key.get_buffer (), 00230 _tao_seq_len); 00231 #else /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ 00232 return strm.read_octet_array (key.get_buffer (), key.length ()); 00233 #endif /* TAO_NO_COPY_OCTET_SEQUENCES == 0 */ 00234 00235 } 00236 return 0; 00237 } |
|
Definition at line 100 of file Object_KeyC.cpp. References is_legal(), TAO::unbounded_value_sequence< T >::length(), ACE::nibble2hex(), and CORBA::string_alloc(). Referenced by TAO_IIOP_Profile::to_string().
00102 { 00103 // We must allocate a buffer which is (gag) 3 times the length 00104 // of the sequence, which is the length required in the worst-case 00105 // scenario of all non-printable characters. 00106 // 00107 // There are two strategies here...we could allocate all that space here, 00108 // fill it up, then copy-allocate new space of just the right length. 00109 // OR, we could just return this space. The classic time-space tradeoff, 00110 // and for now we'll let time win out, which means that we only do the 00111 // allocation once. 00112 u_int len = 3 * seq.length (); /* space for zero termination not needed */; 00113 str = CORBA::string_alloc (len); 00114 00115 char *cp = str; 00116 00117 for (u_int i = 0; 00118 cp < (str + len) && i < seq.length(); 00119 ++i) 00120 { 00121 u_char bt = seq[i]; 00122 if (is_legal (bt)) 00123 { 00124 *cp++ = (char) bt; 00125 continue; 00126 } 00127 00128 *cp++ = '%'; 00129 *cp++ = ACE::nibble2hex ((bt >> 4) & 0x0f); 00130 *cp++ = ACE::nibble2hex (bt & 0x0f); 00131 } 00132 // Zero terminate 00133 *cp = '\0'; 00134 } |
|
Definition at line 136 of file Object_KeyC.cpp. Referenced by encode_sequence_to_string().
00137 { 00138 if (isalnum(c)) 00139 { 00140 return 1; 00141 } 00142 else 00143 { 00144 return ( c == ';' || c == '/' ||c == ':' || c == '?' || 00145 c == '@' || c == '&' ||c == '=' || c == '+' || 00146 c == '$' || c == ',' ||c == '_' || c == '.' || 00147 c == '!' || c == '~' ||c == '*' || c == '\'' || 00148 c == '-' || c == '(' || c == ')' ); 00149 } 00150 } |