00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00048 #ifndef COMSTL_INCL_COMSTL_SHIMS_ACCESS_STRING_HPP_GUID
00049 #define COMSTL_INCL_COMSTL_SHIMS_ACCESS_STRING_HPP_GUID
00050
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define COMSTL_VER_COMSTL_SHIMS_ACCESS_STRING_HPP_GUID_MAJOR 5
00053 # define COMSTL_VER_COMSTL_SHIMS_ACCESS_STRING_HPP_GUID_MINOR 1
00054 # define COMSTL_VER_COMSTL_SHIMS_ACCESS_STRING_HPP_GUID_REVISION 1
00055 # define COMSTL_VER_COMSTL_SHIMS_ACCESS_STRING_HPP_GUID_EDIT 114
00056 #endif
00057
00058
00059
00060
00061
00062 #ifndef COMSTL_INCL_COMSTL_H_COMSTL
00063 # include <comstl/comstl.h>
00064 #endif
00065 #ifndef COMSTL_INCL_COMSTL_STRING_H_BSTR_FUNCTIONS
00066 # include <comstl/string/BSTR_functions.h>
00067 #endif
00068 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
00069 # include <stlsoft/shims/access/string.hpp>
00070 #endif
00071
00072 #ifndef STLSOFT_INCL_H_WCHAR
00073 # define STLSOFT_INCL_H_WCHAR
00074 # include <wchar.h>
00075 #endif
00076
00077
00078
00079
00080
00081 #ifndef _COMSTL_NO_NAMESPACE
00082 # if defined(_STLSOFT_NO_NAMESPACE) || \
00083 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00084
00085 namespace comstl
00086 {
00087 # else
00088
00089
00090 namespace stlsoft
00091 {
00092
00093 namespace comstl_project
00094 {
00095
00096 # endif
00097 #endif
00098
00099
00100
00101
00102
00103 inline cs_size_t guid2string_w(GUID const& guid, cs_char_w_t buff[1 + COMSTL_CCH_GUID])
00104 {
00105 return static_cast<cs_size_t>(StringFromGUID2(guid, buff, 1 + COMSTL_CCH_GUID));
00106 }
00107
00108 inline cs_size_t guid2string_a(GUID const& guid, cs_char_a_t buff[1 + COMSTL_CCH_GUID])
00109 {
00110 const cs_size_t COMSTL_CCH_GUID_AND_NULL = COMSTL_CCH_GUID + 1;
00111
00112
00113 #ifdef STLSOFT_COMPILER_IS_BORLAND
00114 int buff__[COMSTL_CCH_GUID_AND_NULL];
00115 cs_char_w_t *buff_ = (wchar_t *)buff__;
00116 #else
00117 cs_char_w_t buff_[COMSTL_CCH_GUID_AND_NULL];
00118 #endif
00119 cs_size_t cch = guid2string_w(guid, buff_);
00120
00121 ::WideCharToMultiByte(0, 0, buff_, COMSTL_CCH_GUID_AND_NULL, buff, COMSTL_CCH_GUID_AND_NULL, 0, 0);
00122
00123 return cch;
00124 }
00125
00126
00127
00128
00129
00130
00131
00139 template <ss_typename_param_k C>
00140 class c_str_ptr_GUID_proxy
00141 {
00142 public:
00143 typedef C char_type;
00144 typedef c_str_ptr_GUID_proxy<C> class_type;
00145
00146
00147 public:
00151 ss_explicit_k c_str_ptr_GUID_proxy(GUID const& guid);
00152
00154 c_str_ptr_GUID_proxy(class_type const& rhs)
00155 : m_(m_buffer)
00156 {
00157 for(cs_size_t i = 0; i < STLSOFT_NUM_ELEMENTS(m_buffer); ++i)
00158 {
00159 m_buffer[i] = rhs.m_buffer[i];
00160 }
00161 }
00162
00163
00164 public:
00166 operator char_type const* () const
00167 {
00168 return m_buffer;
00169 }
00170
00171
00172 private:
00173 char_type const* const m_;
00174 char_type m_buffer[1 + COMSTL_CCH_GUID];
00175
00176
00177 private:
00178 void operator =(class_type const& rhs);
00179 };
00180
00181 STLSOFT_TEMPLATE_SPECIALISATION
00182 inline c_str_ptr_GUID_proxy<cs_char_a_t>::c_str_ptr_GUID_proxy(GUID const& guid)
00183 : m_(m_buffer)
00184 {
00185 #ifndef STLSOFT_COMPILER_IS_BORLAND
00186 COMSTL_STATIC_ASSERT(STLSOFT_NUM_ELEMENTS(m_buffer) > COMSTL_CCH_GUID);
00187 #endif
00188
00189 guid2string_a(guid, m_buffer);
00190 }
00191
00192 STLSOFT_TEMPLATE_SPECIALISATION
00193 inline c_str_ptr_GUID_proxy<cs_char_w_t>::c_str_ptr_GUID_proxy(GUID const& guid)
00194 : m_(m_buffer)
00195 {
00196 #ifndef STLSOFT_COMPILER_IS_BORLAND
00197 COMSTL_STATIC_ASSERT(STLSOFT_NUM_ELEMENTS(m_buffer) > COMSTL_CCH_GUID);
00198 #endif
00199
00200 guid2string_w(guid, m_buffer);
00201 }
00202
00203
00204
00205
00206
00207
00208
00209 template <ss_typename_param_k C>
00210 inline cs_bool_t operator ==(C const* lhs, c_str_ptr_GUID_proxy<C> const& rhs)
00211 {
00212 return lhs == static_cast<C const*>(rhs);
00213 }
00214
00215 template <ss_typename_param_k C>
00216 inline cs_bool_t operator ==(c_str_ptr_GUID_proxy<C> const& lhs, C const* rhs)
00217 {
00218 return static_cast<C const*>(lhs) == rhs;
00219 }
00220
00221 template <ss_typename_param_k C>
00222 inline cs_bool_t operator !=(C const* lhs, c_str_ptr_GUID_proxy<C> const& rhs)
00223 {
00224 return lhs != static_cast<C const*>(rhs);
00225 }
00226
00227 template <ss_typename_param_k C>
00228 inline cs_bool_t operator !=(c_str_ptr_GUID_proxy<C> const& lhs, C const* rhs)
00229 {
00230 return static_cast<C const*>(lhs) != rhs;
00231 }
00232
00233
00234
00235
00236
00237 template< ss_typename_param_k C
00238 , ss_typename_param_k S
00239 >
00240 inline S& operator <<(S& s, c_str_ptr_GUID_proxy<C> const& shim)
00241 {
00242 s << static_cast<C const*>(shim);
00243
00244 return s;
00245 }
00246
00247
00248
00249
00250
00251
00252
00253
00254 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00255
00256 inline c_str_ptr_GUID_proxy<cs_char_a_t> c_str_data_a(GUID const& guid)
00257 {
00258 return c_str_ptr_GUID_proxy<cs_char_a_t>(guid);
00259 }
00260
00261 inline c_str_ptr_GUID_proxy<cs_char_w_t> c_str_data_w(GUID const& guid)
00262 {
00263 return c_str_ptr_GUID_proxy<cs_char_w_t>(guid);
00264 }
00265
00266 inline c_str_ptr_GUID_proxy<cs_char_o_t> c_str_data_o(GUID const& guid)
00267 {
00268 return c_str_ptr_GUID_proxy<cs_char_o_t>(guid);
00269 }
00270
00271 #endif
00272
00278 inline c_str_ptr_GUID_proxy<TCHAR> c_str_data(GUID const& guid)
00279 {
00280 #ifdef UNICODE
00281 return c_str_data_w(guid);
00282 #else
00283 return c_str_data_a(guid);
00284 #endif
00285 }
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00297
00298 inline cs_size_t c_str_len_a(GUID const& )
00299 {
00300 return COMSTL_CCH_GUID;
00301 }
00302
00303 inline cs_size_t c_str_len_w(GUID const& )
00304 {
00305 return COMSTL_CCH_GUID;
00306 }
00307
00308 inline cs_size_t c_str_len_o(GUID const& )
00309 {
00310 return COMSTL_CCH_GUID;
00311 }
00312
00313 #endif
00314
00320 inline cs_size_t c_str_len(GUID const& )
00321 {
00322 return COMSTL_CCH_GUID;
00323 }
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00335
00336 inline c_str_ptr_GUID_proxy<cs_char_a_t> c_str_ptr_a(GUID const& guid)
00337 {
00338 return c_str_ptr_GUID_proxy<cs_char_a_t>(guid);
00339 }
00340
00341 inline c_str_ptr_GUID_proxy<cs_char_w_t> c_str_ptr_w(GUID const& guid)
00342 {
00343 return c_str_ptr_GUID_proxy<cs_char_w_t>(guid);
00344 }
00345
00346 inline c_str_ptr_GUID_proxy<cs_char_o_t> c_str_ptr_o(GUID const& guid)
00347 {
00348 return c_str_ptr_GUID_proxy<cs_char_o_t>(guid);
00349 }
00350
00351 #endif
00352
00358 inline c_str_ptr_GUID_proxy<TCHAR> c_str_ptr(GUID const& guid)
00359 {
00360 #ifdef UNICODE
00361 return c_str_ptr_w(guid);
00362 #else
00363 return c_str_ptr_a(guid);
00364 #endif
00365 }
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00377
00378 inline c_str_ptr_GUID_proxy<cs_char_a_t> c_str_ptr_null_a(GUID const& guid)
00379 {
00380 return c_str_ptr_GUID_proxy<cs_char_a_t>(guid);
00381 }
00382
00383 inline c_str_ptr_GUID_proxy<cs_char_w_t> c_str_ptr_null_w(GUID const& guid)
00384 {
00385 return c_str_ptr_GUID_proxy<cs_char_w_t>(guid);
00386 }
00387
00388 inline c_str_ptr_GUID_proxy<cs_char_o_t> c_str_ptr_null_o(GUID const& guid)
00389 {
00390 return c_str_ptr_GUID_proxy<cs_char_o_t>(guid);
00391 }
00392
00393 #endif
00394
00400 inline c_str_ptr_GUID_proxy<TCHAR> c_str_ptr_null(GUID const& guid)
00401 {
00402 #ifdef UNICODE
00403 return c_str_ptr_null_w(guid);
00404 #else
00405 return c_str_ptr_null_a(guid);
00406 #endif
00407 }
00408
00410
00411
00412 #ifdef STLSOFT_UNITTEST
00413 # include "./unittest/guid_unittest_.h"
00414 #endif
00415
00416
00417
00418 #ifndef _COMSTL_NO_NAMESPACE
00419 # if defined(_STLSOFT_NO_NAMESPACE) || \
00420 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00421 }
00422 # else
00423 }
00424 }
00425 # endif
00426 #endif
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436 #ifndef _COMSTL_NO_NAMESPACE
00437 # if !defined(_STLSOFT_NO_NAMESPACE) && \
00438 !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00439 namespace stlsoft
00440 {
00441 # else
00442
00443 # endif
00444
00445 using ::comstl::c_str_data_a;
00446 using ::comstl::c_str_data_w;
00447 using ::comstl::c_str_data_o;
00448 using ::comstl::c_str_data;
00449
00450 using ::comstl::c_str_len_a;
00451 using ::comstl::c_str_len_w;
00452 using ::comstl::c_str_len_o;
00453 using ::comstl::c_str_len;
00454
00455 using ::comstl::c_str_ptr_a;
00456 using ::comstl::c_str_ptr_w;
00457 using ::comstl::c_str_ptr_o;
00458 using ::comstl::c_str_ptr;
00459
00460 using ::comstl::c_str_ptr_null_a;
00461 using ::comstl::c_str_ptr_null_w;
00462 using ::comstl::c_str_ptr_null_o;
00463 using ::comstl::c_str_ptr_null;
00464
00465 # if !defined(_STLSOFT_NO_NAMESPACE) && \
00466 !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00467 }
00468 # else
00469
00470 # endif
00471 #endif
00472
00473
00474
00475 #endif
00476
00477