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 ATLSTL_INCL_ATLSTL_SHIMS_ACCESS_STRING_HPP_CWINDOW
00049 #define ATLSTL_INCL_ATLSTL_SHIMS_ACCESS_STRING_HPP_CWINDOW
00050
00051 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00052 # define ATLSTL_VER_ATLSTL_SHIMS_ACCESS_STRING_HPP_CWINDOW_MAJOR 4
00053 # define ATLSTL_VER_ATLSTL_SHIMS_ACCESS_STRING_HPP_CWINDOW_MINOR 0
00054 # define ATLSTL_VER_ATLSTL_SHIMS_ACCESS_STRING_HPP_CWINDOW_REVISION 3
00055 # define ATLSTL_VER_ATLSTL_SHIMS_ACCESS_STRING_HPP_CWINDOW_EDIT 102
00056 #endif
00057
00058
00059
00060
00061
00062 #ifndef ATLSTL_INCL_ATLSTL_HPP_ATLSTL
00063 # include <atlstl/atlstl.hpp>
00064 #endif
00065 #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
00066 # include <stlsoft/shims/access/string.hpp>
00067 #endif
00068 #ifndef STLSOFT_INCL_STLSOFT_STRING_HPP_CSTRING_MAKER
00069 # include <stlsoft/string/cstring_maker.hpp>
00070 #endif
00071
00072 #ifdef STLSOFT_UNITTEST
00073 # include <wchar.h>
00074 #endif
00075 #ifndef STLSOFT_INCL_SYS_H_ATLWIN
00076 # define STLSOFT_INCL_SYS_H_ATLWIN
00077 # include <atlwin.h>
00078 #endif
00079
00080
00081
00082
00083
00084 #ifndef _ATLSTL_NO_NAMESPACE
00085 # if defined(_STLSOFT_NO_NAMESPACE) || \
00086 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00087
00088 namespace atlstl
00089 {
00090 # else
00091
00092
00093 namespace stlsoft
00094 {
00095
00096 namespace atlstl_project
00097 {
00098
00099 # endif
00100 #endif
00101
00102
00103
00104
00105
00106
00107
00115 struct c_str_ptr_null_CWindow_proxy
00116 {
00117 private:
00118 typedef cstring_maker<TCHAR> string_maker_type;
00119 typedef c_str_ptr_null_CWindow_proxy class_type;
00120
00121
00122 public:
00126 ss_explicit_k c_str_ptr_null_CWindow_proxy(CWindow const& w)
00127 {
00128 int length = (NULL == w.m_hWnd) ? 0 : w.GetWindowTextLength();
00129
00130 if(length == 0)
00131 {
00132 m_buffer = NULL;
00133 }
00134 else
00135 {
00136 m_buffer = string_maker_type::alloc(length);
00137
00138 if(NULL != m_buffer)
00139 {
00140 w.GetWindowText(m_buffer, length + 1);
00141 }
00142 }
00143 }
00144
00145 #ifdef STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT
00154 c_str_ptr_null_CWindow_proxy(class_type& rhs)
00155 : m_buffer(rhs.m_buffer)
00156 {
00157 rhs.m_buffer = 0;
00158 }
00159 #else
00160
00161 c_str_ptr_null_CWindow_proxy(class_type const& rhs)
00162 : m_buffer(string_maker_type::dup_null(rhs.m_buffer))
00163 {}
00164 #endif
00165
00167 ~c_str_ptr_null_CWindow_proxy() stlsoft_throw_0()
00168 {
00169 string_maker_type::free(m_buffer);
00170 }
00171
00172
00173 public:
00176 operator LPCTSTR () const
00177 {
00178 return m_buffer;
00179 }
00180
00181
00182 private:
00183 LPTSTR m_buffer;
00184
00185
00186 private:
00187 void operator =(class_type const& rhs);
00188 };
00189
00197 struct c_str_ptr_CWindow_proxy
00198 {
00199 private:
00200 typedef cstring_maker<TCHAR> string_maker_type;
00201 typedef c_str_ptr_CWindow_proxy class_type;
00202
00203
00204 public:
00208 ss_explicit_k c_str_ptr_CWindow_proxy(CWindow const& w)
00209 {
00210 int length = (NULL == w.m_hWnd) ? 0 : w.GetWindowTextLength();
00211
00212 if(length == 0)
00213 {
00214 m_buffer = string_maker_type::dup("");
00215 }
00216 else
00217 {
00218 m_buffer = string_maker_type::alloc(length);
00219
00220 if(NULL != m_buffer)
00221 {
00222 w.GetWindowText(m_buffer, length + 1);
00223 }
00224 }
00225 }
00226
00227 #ifdef STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT
00236 c_str_ptr_CWindow_proxy(class_type& rhs)
00237 : m_buffer(rhs.m_buffer)
00238 {
00239 rhs.m_buffer = 0;
00240 }
00241 #else
00242
00243 c_str_ptr_CWindow_proxy(class_type const& rhs)
00244 : m_buffer(string_maker_type::dup_null(rhs.m_buffer))
00245 {}
00246 #endif
00247
00249 ~c_str_ptr_CWindow_proxy() stlsoft_throw_0()
00250 {
00251 string_maker_type::free(m_buffer);
00252 }
00253
00254
00255 public:
00258 operator LPCTSTR () const
00259 {
00260 return (NULL == m_buffer) ? "" : m_buffer;
00261 }
00262
00263
00264 private:
00265 LPTSTR m_buffer;
00266
00267
00268 private:
00269 void operator =(class_type const& rhs);
00270 };
00271
00272
00273
00274
00275
00276 inline as_bool_t operator ==(LPCTSTR lhs, c_str_ptr_null_CWindow_proxy const& rhs)
00277 {
00278 return lhs == static_cast<LPCTSTR>(rhs);
00279 }
00280
00281 inline as_bool_t operator ==(c_str_ptr_null_CWindow_proxy const& lhs, LPCTSTR rhs)
00282 {
00283 return static_cast<LPCTSTR>(lhs) == rhs;
00284 }
00285
00286 inline as_bool_t operator !=(LPCTSTR lhs, c_str_ptr_null_CWindow_proxy const& rhs)
00287 {
00288 return lhs != static_cast<LPCTSTR>(rhs);
00289 }
00290
00291 inline as_bool_t operator !=(c_str_ptr_null_CWindow_proxy const& lhs, LPCTSTR rhs)
00292 {
00293 return static_cast<LPCTSTR>(lhs) != rhs;
00294 }
00295
00296
00297
00298
00299
00300 template<ss_typename_param_k S>
00301 inline S& operator <<(S& s, c_str_ptr_null_CWindow_proxy const& shim)
00302 {
00303 s << static_cast<LPCTSTR>(shim);
00304
00305 return s;
00306 }
00307
00308 template <ss_typename_param_k S>
00309 inline S& operator <<(S& s, c_str_ptr_CWindow_proxy const& shim)
00310 {
00311 s << static_cast<LPCTSTR>(shim);
00312
00313 return s;
00314 }
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00330 inline c_str_ptr_CWindow_proxy c_str_data(atlstl_ns_qual_atl(CWindow) const& w)
00331 {
00332 return c_str_ptr_CWindow_proxy(w);
00333 }
00334
00335 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00336 # ifdef UNICODE
00337 inline c_str_ptr_CWindow_proxy c_str_data_w(atlstl_ns_qual_atl(CWindow) const& w)
00338 # else
00339 inline c_str_ptr_CWindow_proxy c_str_data_a(atlstl_ns_qual_atl(CWindow) const& w)
00340 # endif
00341 {
00342 return c_str_data(w);
00343 }
00344 #endif
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00360 inline as_size_t c_str_len(atlstl_ns_qual_atl(CWindow) const& w)
00361 {
00362 return static_cast<as_size_t>(w.GetWindowTextLength());
00363 }
00364
00365 #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00366 # ifdef UNICODE
00367 inline as_size_t c_str_len_w(atlstl_ns_qual_atl(CWindow) const& w)
00368 # else
00369 inline as_size_t c_str_len_a(atlstl_ns_qual_atl(CWindow) const& w)
00370 # endif
00371 {
00372 return c_str_len(w);
00373 }
00374 #endif
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00390 inline c_str_ptr_CWindow_proxy c_str_ptr(atlstl_ns_qual_atl(CWindow) const& w)
00391 {
00392 return c_str_ptr_CWindow_proxy(w);
00393 }
00394
00395 # ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00396 # ifdef UNICODE
00397 inline c_str_ptr_CWindow_proxy c_str_ptr_w(atlstl_ns_qual_atl(CWindow) const& w)
00398 # else
00399 inline c_str_ptr_CWindow_proxy c_str_ptr_a(atlstl_ns_qual_atl(CWindow) const& w)
00400 # endif
00401 {
00402 return c_str_ptr(w);
00403 }
00404 # endif
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00420 inline c_str_ptr_null_CWindow_proxy c_str_ptr_null(atlstl_ns_qual_atl(CWindow) const& w)
00421 {
00422 return c_str_ptr_null_CWindow_proxy(w);
00423 }
00424
00425 # ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
00426 # ifdef UNICODE
00427 inline c_str_ptr_null_CWindow_proxy c_str_ptr_null_w(atlstl_ns_qual_atl(CWindow) const& w)
00428 # else
00429 inline c_str_ptr_null_CWindow_proxy c_str_ptr_null_a(atlstl_ns_qual_atl(CWindow) const& w)
00430 # endif
00431 {
00432 return c_str_ptr_null(w);
00433 }
00434 # endif
00435
00437
00438
00439 #ifdef STLSOFT_UNITTEST
00440 # include "./unittest/cwindow_unittest_.h"
00441 #endif
00442
00443
00444
00445 #ifndef _ATLSTL_NO_NAMESPACE
00446 # if defined(_STLSOFT_NO_NAMESPACE) || \
00447 defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00448 }
00449 # else
00450 }
00451 }
00452 # endif
00453 #endif
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463 #ifndef _ATLSTL_NO_NAMESPACE
00464 # if !defined(_STLSOFT_NO_NAMESPACE) && \
00465 !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00466 namespace stlsoft
00467 {
00468 # else
00469
00470 # endif
00471
00472 using ::atlstl::c_str_data;
00473 #if defined(UNICODE)
00474 using ::atlstl::c_str_data_w;
00475 #else
00476 using ::atlstl::c_str_data_a;
00477 #endif
00478
00479 using ::atlstl::c_str_len;
00480 #if defined(UNICODE)
00481 using ::atlstl::c_str_len_w;
00482 #else
00483 using ::atlstl::c_str_len_a;
00484 #endif
00485
00486 using ::atlstl::c_str_ptr;
00487 #if defined(UNICODE)
00488 using ::atlstl::c_str_ptr_w;
00489 #else
00490 using ::atlstl::c_str_ptr_a;
00491 #endif
00492
00493 using ::atlstl::c_str_ptr_null;
00494 #if defined(UNICODE)
00495 using ::atlstl::c_str_ptr_null_w;
00496 #else
00497 using ::atlstl::c_str_ptr_null_a;
00498 #endif
00499
00500 # if !defined(_STLSOFT_NO_NAMESPACE) && \
00501 !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
00502 }
00503 # else
00504
00505 # endif
00506 #endif
00507
00508
00509
00510 #endif
00511
00512