You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

710 lines
21 KiB

  1. /* /////////////////////////////////////////////////////////////////////////
  2. * File: winstl/shims/access/string/HWND.hpp
  3. *
  4. * Purpose: Contains classes and functions for dealing with Win32 strings.
  5. *
  6. * Created: 24th May 2002
  7. * Updated: 22nd December 2009
  8. *
  9. * Home: http://stlsoft.org/
  10. *
  11. * Copyright (c) 2002-2009, Matthew Wilson and Synesis Software
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions are met:
  16. *
  17. * - Redistributions of source code must retain the above copyright notice, this
  18. * list of conditions and the following disclaimer.
  19. * - Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
  23. * any contributors may be used to endorse or promote products derived from
  24. * this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  27. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  29. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  30. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  31. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  32. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  33. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  34. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  35. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * ////////////////////////////////////////////////////////////////////// */
  39. /** \file winstl/shims/access/string/HWND.hpp
  40. *
  41. * \brief [C++] Definition of the string access shims for
  42. * <code>HWND</code>
  43. * (\ref group__concept__shim__string_access "String Access Shims" Concept).
  44. */
  45. #ifndef WINSTL_INCL_WINSTL_SHIMS_ACCESS_STRING_HPP_HWND
  46. #define WINSTL_INCL_WINSTL_SHIMS_ACCESS_STRING_HPP_HWND
  47. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  48. # define WINSTL_VER_WINSTL_SHIMS_ACCESS_STRING_HPP_HWND_MAJOR 4
  49. # define WINSTL_VER_WINSTL_SHIMS_ACCESS_STRING_HPP_HWND_MINOR 1
  50. # define WINSTL_VER_WINSTL_SHIMS_ACCESS_STRING_HPP_HWND_REVISION 1
  51. # define WINSTL_VER_WINSTL_SHIMS_ACCESS_STRING_HPP_HWND_EDIT 113
  52. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  53. /* /////////////////////////////////////////////////////////////////////////
  54. * Includes
  55. */
  56. #ifndef WINSTL_INCL_WINSTL_H_WINSTL
  57. # include <winstl/winstl.h>
  58. #endif /* !WINSTL_INCL_WINSTL_H_WINSTL */
  59. #ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
  60. # include <stlsoft/shims/access/string.hpp>
  61. #endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING */
  62. #ifndef WINSTL_INCL_WINSTL_WINDOW_H_FUNCTIONS
  63. # include <winstl/window/functions.h>
  64. #endif /* !WINSTL_INCL_WINSTL_WINDOW_H_FUNCTIONS */
  65. #ifndef WINSTL_INCL_WINSTL_WINDOW_UTIL_HPP_IDENT_
  66. # include <winstl/window/util/ident_.hpp>
  67. #endif /* !WINSTL_INCL_WINSTL_WINDOW_UTIL_HPP_IDENT_ */
  68. #ifndef STLSOFT_INCL_STLSOFT_STRING_HPP_CSTRING_MAKER
  69. # include <stlsoft/string/cstring_maker.hpp>
  70. #endif /* !STLSOFT_INCL_STLSOFT_STRING_HPP_CSTRING_MAKER */
  71. /* /////////////////////////////////////////////////////////////////////////
  72. * Compatibility
  73. */
  74. #ifdef NOUSER
  75. # error This file cannot be used when NOUSER is specified (to suppress the Windows User API)
  76. #endif /* NOUSER */
  77. #ifdef NOWINOFFSETS
  78. # error This file cannot be used when NOWINOFFSETS is specified (to suppress GWL_*, GCL_*, associated routines)
  79. #endif /* NOWINOFFSETS */
  80. /* /////////////////////////////////////////////////////////////////////////
  81. * Namespace
  82. */
  83. #ifndef _WINSTL_NO_NAMESPACE
  84. # if defined(_STLSOFT_NO_NAMESPACE) || \
  85. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  86. /* There is no stlsoft namespace, so must define ::winstl */
  87. namespace winstl
  88. {
  89. # else
  90. /* Define stlsoft::winstl_project */
  91. namespace stlsoft
  92. {
  93. namespace winstl_project
  94. {
  95. # endif /* _STLSOFT_NO_NAMESPACE */
  96. #endif /* !_WINSTL_NO_NAMESPACE */
  97. /* /////////////////////////////////////////////////////////////////////////
  98. * Functions
  99. */
  100. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  101. inline ws_size_t GetWindowTextLength_T_(HWND hwnd, int (WINAPI *pfn)(HWND ))
  102. {
  103. WINSTL_ASSERT(NULL != pfn);
  104. WindowIdent ident = GetWindowIdent(hwnd);
  105. int sel;
  106. # ifndef NOWINSTYLES
  107. const long lbsStyle = LBS_MULTIPLESEL | LBS_EXTENDEDSEL;
  108. # else /* ? NOWINSTYLES */
  109. const long lbsStyle = 0x0008L | 0x0800L;
  110. # endif /* NOWINSTYLES */
  111. switch(ident)
  112. {
  113. case ListBox:
  114. if(0 == (GetStyle(hwnd) & lbsStyle))
  115. {
  116. sel = static_cast<int>(::SendMessage(hwnd, LB_GETCURSEL, 0, 0l));
  117. if(LB_ERR != sel)
  118. {
  119. return static_cast<ws_size_t>(::SendMessage(hwnd, LB_GETTEXTLEN, static_cast<WPARAM>(sel), 0L));
  120. }
  121. else
  122. {
  123. return 0;
  124. }
  125. }
  126. break;
  127. #if 0
  128. case ListBox:
  129. if(1 == SendMessage(hwnd, LVM_GETSELECTEDCOUNT, 0, 0L))
  130. {
  131. sel =
  132. }
  133. break;
  134. #endif /* 0 */
  135. case Generic:
  136. case ComboBox:
  137. case ListView:
  138. default:
  139. break;
  140. }
  141. return static_cast<ws_size_t>(pfn(hwnd));
  142. }
  143. inline ws_size_t GetWindowTextLength_T_(HWND hwnd)
  144. {
  145. return GetWindowTextLength_T_(hwnd, ::GetWindowTextLength);
  146. }
  147. inline ws_size_t GetWindowTextLength_A_(HWND hwnd)
  148. {
  149. return GetWindowTextLength_T_(hwnd, ::GetWindowTextLengthA);
  150. }
  151. inline ws_size_t GetWindowTextLength_W_(HWND hwnd)
  152. {
  153. return GetWindowTextLength_T_(hwnd, ::GetWindowTextLengthW);
  154. }
  155. template <ss_typename_param_k C>
  156. struct WindowTextLength_traits;
  157. STLSOFT_TEMPLATE_SPECIALISATION
  158. struct WindowTextLength_traits<ws_char_a_t>
  159. {
  160. static ws_size_t get_length(HWND hwnd)
  161. {
  162. return GetWindowTextLength_A_(hwnd);
  163. }
  164. };
  165. STLSOFT_TEMPLATE_SPECIALISATION
  166. struct WindowTextLength_traits<ws_char_w_t>
  167. {
  168. static ws_size_t get_length(HWND hwnd)
  169. {
  170. return GetWindowTextLength_W_(hwnd);
  171. }
  172. };
  173. inline ws_size_t GetWindowText_A_(HWND hwnd, ws_char_a_t *buffer, ws_size_t cchBuffer)
  174. {
  175. WindowIdent ident = GetWindowIdent(hwnd);
  176. int sel;
  177. ws_size_t cch;
  178. switch(ident)
  179. {
  180. case ListBox:
  181. if(0 == (GetStyle(hwnd) & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)))
  182. {
  183. sel = static_cast<int>(::SendMessage(hwnd, LB_GETCURSEL, 0, 0l));
  184. if(LB_ERR != sel)
  185. {
  186. cch = static_cast<ws_size_t>(::SendMessage(hwnd, LB_GETTEXT, static_cast<WPARAM>(sel), reinterpret_cast<LPARAM>(buffer)));
  187. // Some programs using list-boxes do not null-terminate - Visual
  188. // SourceSafe Explorer, anyone? - so we must do so here.
  189. buffer[cch] = '\0';
  190. }
  191. else
  192. {
  193. buffer[0] = '\0';
  194. cch = 0;
  195. }
  196. WINSTL_MESSAGE_ASSERT("Buffer overwrite", !(cchBuffer < cch));
  197. return cch;
  198. }
  199. break;
  200. case Generic:
  201. case ComboBox:
  202. case ListView:
  203. default:
  204. break;
  205. }
  206. return static_cast<ws_size_t>(::GetWindowTextA(hwnd, buffer, static_cast<int>(cchBuffer)));
  207. }
  208. inline ws_size_t GetWindowText_W_(HWND hwnd, ws_char_w_t *buffer, ws_size_t cchBuffer)
  209. {
  210. WindowIdent ident = GetWindowIdent(hwnd);
  211. int sel;
  212. switch(ident)
  213. {
  214. case ListBox:
  215. if(0 == (GetStyle(hwnd) & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL)))
  216. {
  217. ws_size_t cch;
  218. sel = static_cast<int>(::SendMessage(hwnd, LB_GETCURSEL, 0, 0l));
  219. if(LB_ERR != sel)
  220. {
  221. cch = static_cast<ws_size_t>(::SendMessage(hwnd, LB_GETTEXT, static_cast<WPARAM>(sel), reinterpret_cast<LPARAM>(buffer)));
  222. }
  223. else
  224. {
  225. buffer[0] = '\0';
  226. cch = 0;
  227. }
  228. WINSTL_MESSAGE_ASSERT("Buffer overwrite", !(cchBuffer < cch));
  229. return cch;
  230. }
  231. break;
  232. case Generic:
  233. case ComboBox:
  234. case ListView:
  235. default:
  236. break;
  237. }
  238. return static_cast<ws_size_t>(::GetWindowTextW(hwnd, buffer, static_cast<int>(cchBuffer)));
  239. }
  240. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  241. /* /////////////////////////////////////////////////////////////////////////
  242. * Classes
  243. */
  244. /* HWND */
  245. /** \brief This class provides an intermediary object that may be returned by the
  246. * c_str_ptr_null() function, such that the window text of a given window may be
  247. * accessed as a null-terminated string.
  248. *
  249. * \ingroup group__concept__shim__string_access
  250. *
  251. */
  252. template <ss_typename_param_k C>
  253. class c_str_ptr_null_HWND_proxy
  254. {
  255. typedef cstring_maker<C> string_maker_type;
  256. public:
  257. /// The character type
  258. typedef C char_type;
  259. /// This type
  260. typedef c_str_ptr_null_HWND_proxy<C> class_type;
  261. // Construction
  262. public:
  263. /// Constructs an instance of the proxy from the given HWND
  264. ///
  265. /// \param h The HWND from which the text will be retrieved
  266. ss_explicit_k c_str_ptr_null_HWND_proxy(HWND h)
  267. {
  268. ws_size_t length = WindowTextLength_traits<C>::get_length(h);
  269. if(length == 0)
  270. {
  271. m_buffer = NULL;
  272. }
  273. else
  274. {
  275. m_buffer = string_maker_type::alloc(length);
  276. if(NULL != m_buffer)
  277. {
  278. get_window_text(h, m_buffer, length + 1);
  279. }
  280. }
  281. }
  282. #ifdef STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT
  283. /// Move constructor
  284. ///
  285. /// This <a href = "http://synesis.com.au/resources/articles/cpp/movectors.pdf">move constructor</a>
  286. /// is for circumstances when the compiler does not, or cannot, apply the
  287. /// return value optimisation. It causes the contents of \c rhs to be
  288. /// transferred into the constructing instance. This is completely safe
  289. /// because the \c rhs instance will never be accessed in its own right, so
  290. /// does not need to maintain ownership of its contents.
  291. c_str_ptr_null_HWND_proxy(class_type& rhs)
  292. : m_buffer(rhs.m_buffer)
  293. {
  294. move_lhs_from_rhs(rhs).m_buffer = NULL;
  295. }
  296. #else /* ? STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  297. // Copy constructor
  298. c_str_ptr_null_HWND_proxy(class_type const& rhs)
  299. : m_buffer(string_maker_type::dup_null(rhs.m_buffer))
  300. {}
  301. #endif /* STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  302. /// Releases any storage aquired by the proxy
  303. ~c_str_ptr_null_HWND_proxy() stlsoft_throw_0()
  304. {
  305. string_maker_type::free(m_buffer);
  306. }
  307. // Accessors
  308. public:
  309. /// Returns a null-terminated string representing the window contents, or
  310. /// the empty string "" if the window contains no text.
  311. operator char_type const* () const
  312. {
  313. return m_buffer;
  314. }
  315. // Implementation
  316. private:
  317. ws_size_t get_window_text(HWND h, char_type* buffer, ws_size_t cchBuffer);
  318. // Members
  319. private:
  320. char_type *m_buffer;
  321. // Not to be implemented
  322. private:
  323. void operator =(class_type const& rhs);
  324. };
  325. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  326. STLSOFT_TEMPLATE_SPECIALISATION
  327. inline ws_size_t c_str_ptr_null_HWND_proxy<ws_char_a_t>::get_window_text(HWND h, ws_char_a_t *buffer, ws_size_t cchBuffer)
  328. {
  329. return GetWindowText_A_(h, buffer, cchBuffer);
  330. }
  331. STLSOFT_TEMPLATE_SPECIALISATION
  332. inline ws_size_t c_str_ptr_null_HWND_proxy<ws_char_w_t>::get_window_text(HWND h, ws_char_w_t *buffer, ws_size_t cchBuffer)
  333. {
  334. return GetWindowText_W_(h, buffer, cchBuffer);
  335. }
  336. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  337. /** \brief This class provides an intermediary object that may be returned by the
  338. * c_str_ptr() function, such that the window text of a given window may be
  339. * accessed as a null-terminated string.
  340. *
  341. * \ingroup group__concept__shim__string_access
  342. *
  343. */
  344. template <ss_typename_param_k C>
  345. class c_str_ptr_HWND_proxy
  346. {
  347. typedef cstring_maker<C> string_maker_type;
  348. public:
  349. /// The character type
  350. typedef C char_type;
  351. /// This type
  352. typedef c_str_ptr_HWND_proxy<C> class_type;
  353. // Construction
  354. public:
  355. /// Constructs an instance of the proxy from the given HWND
  356. ///
  357. /// \param h The HWND from which the text will be retrieved
  358. ss_explicit_k c_str_ptr_HWND_proxy(HWND h)
  359. {
  360. ws_size_t length = WindowTextLength_traits<C>::get_length(h);
  361. m_buffer = string_maker_type::alloc(length);
  362. if(NULL != m_buffer)
  363. {
  364. get_window_text(h, m_buffer, length + 1);
  365. }
  366. }
  367. #ifdef STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT
  368. /// Move constructor
  369. ///
  370. /// This <a href = "http://synesis.com.au/resources/articles/cpp/movectors.pdf">move constructor</a>
  371. /// is for circumstances when the compiler does not, or cannot, apply the
  372. /// return value optimisation. It causes the contents of \c rhs to be
  373. /// transferred into the constructing instance. This is completely safe
  374. /// because the \c rhs instance will never be accessed in its own right, so
  375. /// does not need to maintain ownership of its contents.
  376. c_str_ptr_HWND_proxy(class_type& rhs)
  377. : m_buffer(rhs.m_buffer)
  378. {
  379. move_lhs_from_rhs(rhs).m_buffer = NULL;
  380. }
  381. #else /* ? STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  382. // Copy constructor
  383. c_str_ptr_HWND_proxy(class_type const& rhs)
  384. : m_buffer(string_maker_type::dup_null(rhs.m_buffer))
  385. {}
  386. #endif /* STLSOFT_CF_MOVE_CONSTRUCTOR_SUPPORT */
  387. /// Releases any storage aquired by the proxy
  388. ~c_str_ptr_HWND_proxy() stlsoft_throw_0()
  389. {
  390. string_maker_type::free(m_buffer);
  391. }
  392. // Accessors
  393. public:
  394. /// Returns a null-terminated string representing the window contents, or
  395. /// the empty string "" if the window contains no text.
  396. operator char_type const* () const
  397. {
  398. static char_type s_ch[1] = { '\0' };
  399. return (NULL == m_buffer) ? s_ch : m_buffer;
  400. }
  401. // Implementation
  402. private:
  403. ws_size_t get_window_text(HWND h, char_type* buffer, ws_size_t cchBuffer);
  404. // Members
  405. private:
  406. char_type *m_buffer;
  407. // Not to be implemented
  408. private:
  409. void operator =(class_type const& rhs);
  410. };
  411. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  412. STLSOFT_TEMPLATE_SPECIALISATION
  413. inline ws_size_t c_str_ptr_HWND_proxy<ws_char_a_t>::get_window_text(HWND h, ws_char_a_t *buffer, ws_size_t cchBuffer)
  414. {
  415. return GetWindowText_A_(h, buffer, cchBuffer);
  416. }
  417. STLSOFT_TEMPLATE_SPECIALISATION
  418. inline ws_size_t c_str_ptr_HWND_proxy<ws_char_w_t>::get_window_text(HWND h, ws_char_w_t *buffer, ws_size_t cchBuffer)
  419. {
  420. return GetWindowText_W_(h, buffer, cchBuffer);
  421. }
  422. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  423. /* /////////////////////////////////////////////////////////////////////////
  424. * IOStream compatibility
  425. */
  426. template< ss_typename_param_k C
  427. , ss_typename_param_k S
  428. >
  429. inline S& operator <<(S& s, c_str_ptr_null_HWND_proxy<C> const& shim)
  430. {
  431. s << static_cast<C const*>(shim);
  432. return s;
  433. }
  434. template< ss_typename_param_k C
  435. , ss_typename_param_k S
  436. >
  437. inline S& operator <<(S& s, c_str_ptr_HWND_proxy<C> const& shim)
  438. {
  439. s << static_cast<C const*>(shim);
  440. return s;
  441. }
  442. /* /////////////////////////////////////////////////////////////////////////
  443. * c_str_data
  444. *
  445. * This can be applied to an expression, and the return value is either a
  446. * pointer to the character string or to an empty string.
  447. */
  448. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  449. inline c_str_ptr_HWND_proxy<ws_char_a_t> c_str_data_a(HWND h)
  450. {
  451. return c_str_ptr_HWND_proxy<ws_char_a_t>(h);
  452. }
  453. inline c_str_ptr_HWND_proxy<ws_char_w_t> c_str_data_w(HWND h)
  454. {
  455. return c_str_ptr_HWND_proxy<ws_char_w_t>(h);
  456. }
  457. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  458. /** \brief \ref group__concept__shim__string_access__c_str_data for HWND
  459. *
  460. * \ingroup group__concept__shim__string_access
  461. *
  462. */
  463. inline c_str_ptr_HWND_proxy<TCHAR> c_str_data(HWND h)
  464. {
  465. return c_str_ptr_HWND_proxy<TCHAR>(h);
  466. }
  467. /* /////////////////////////////////////////////////////////////////////////
  468. * c_str_len
  469. *
  470. * This can be applied to an expression, and the return value is the number of
  471. * characters in the character string in the expression.
  472. */
  473. /* HWND */
  474. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  475. inline ws_size_t c_str_len_a(HWND h)
  476. {
  477. return GetWindowTextLength_A_(h);
  478. }
  479. inline ws_size_t c_str_len_w(HWND h)
  480. {
  481. return GetWindowTextLength_W_(h);
  482. }
  483. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  484. /** \brief \ref group__concept__shim__string_access__c_str_len for HWND
  485. *
  486. * \ingroup group__concept__shim__string_access
  487. *
  488. */
  489. inline ws_size_t c_str_len(HWND h)
  490. {
  491. return GetWindowTextLength_T_(h);
  492. }
  493. /* /////////////////////////////////////////////////////////////////////////
  494. * c_str_ptr
  495. *
  496. * This can be applied to an expression, and the return value is either a
  497. * pointer to the character string or to an empty string.
  498. */
  499. /* HWND */
  500. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  501. inline c_str_ptr_HWND_proxy<ws_char_a_t> c_str_ptr_a(HWND h)
  502. {
  503. return c_str_ptr_HWND_proxy<ws_char_a_t>(h);
  504. }
  505. inline c_str_ptr_HWND_proxy<ws_char_w_t> c_str_ptr_w(HWND h)
  506. {
  507. return c_str_ptr_HWND_proxy<ws_char_w_t>(h);
  508. }
  509. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  510. /** \brief \ref group__concept__shim__string_access__c_str_ptr for HWND
  511. *
  512. * \ingroup group__concept__shim__string_access
  513. *
  514. */
  515. inline c_str_ptr_HWND_proxy<TCHAR> c_str_ptr(HWND h)
  516. {
  517. return c_str_ptr_HWND_proxy<TCHAR>(h);
  518. }
  519. /* /////////////////////////////////////////////////////////////////////////
  520. * c_str_ptr_null
  521. *
  522. * This can be applied to an expression, and the return value is either a
  523. * pointer to the character string or NULL.
  524. */
  525. /* HWND */
  526. #ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
  527. inline c_str_ptr_null_HWND_proxy<ws_char_a_t> c_str_ptr_null_a(HWND h)
  528. {
  529. return c_str_ptr_null_HWND_proxy<ws_char_a_t>(h);
  530. }
  531. inline c_str_ptr_null_HWND_proxy<ws_char_w_t> c_str_ptr_null_w(HWND h)
  532. {
  533. return c_str_ptr_null_HWND_proxy<ws_char_w_t>(h);
  534. }
  535. #endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */
  536. /** \brief \ref group__concept__shim__string_access__c_str_ptr_null for HWND
  537. *
  538. * \ingroup group__concept__shim__string_access
  539. *
  540. */
  541. inline c_str_ptr_null_HWND_proxy<TCHAR> c_str_ptr_null(HWND h)
  542. {
  543. return c_str_ptr_null_HWND_proxy<TCHAR>(h);
  544. }
  545. ////////////////////////////////////////////////////////////////////////////
  546. // Unit-testing
  547. #ifdef STLSOFT_UNITTEST
  548. # include "./unittest/hwnd_unittest_.h"
  549. #endif /* STLSOFT_UNITTEST */
  550. /* ////////////////////////////////////////////////////////////////////// */
  551. #ifndef _WINSTL_NO_NAMESPACE
  552. # if defined(_STLSOFT_NO_NAMESPACE) || \
  553. defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  554. } // namespace winstl
  555. # else
  556. } // namespace stlsoft::winstl_project
  557. } // namespace stlsoft
  558. # endif /* _STLSOFT_NO_NAMESPACE */
  559. #endif /* !_WINSTL_NO_NAMESPACE */
  560. /* /////////////////////////////////////////////////////////////////////////
  561. * Namespace
  562. *
  563. * The string access shims exist either in the stlsoft namespace, or in the
  564. * global namespace. This is required by the lookup rules.
  565. *
  566. */
  567. #ifndef _WINSTL_NO_NAMESPACE
  568. # if !defined(_STLSOFT_NO_NAMESPACE) && \
  569. !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  570. namespace stlsoft
  571. {
  572. # else /* ? _STLSOFT_NO_NAMESPACE */
  573. /* There is no stlsoft namespace, so must define in the global namespace */
  574. # endif /* !_STLSOFT_NO_NAMESPACE */
  575. using ::winstl::c_str_data;
  576. using ::winstl::c_str_data_a;
  577. using ::winstl::c_str_data_w;
  578. using ::winstl::c_str_len;
  579. using ::winstl::c_str_len_a;
  580. using ::winstl::c_str_len_w;
  581. using ::winstl::c_str_ptr;
  582. using ::winstl::c_str_ptr_a;
  583. using ::winstl::c_str_ptr_w;
  584. using ::winstl::c_str_ptr_null;
  585. using ::winstl::c_str_ptr_null_a;
  586. using ::winstl::c_str_ptr_null_w;
  587. # if !defined(_STLSOFT_NO_NAMESPACE) && \
  588. !defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
  589. } // namespace stlsoft
  590. # else /* ? _STLSOFT_NO_NAMESPACE */
  591. /* There is no stlsoft namespace, so must define in the global namespace */
  592. # endif /* !_STLSOFT_NO_NAMESPACE */
  593. #endif /* !_WINSTL_NO_NAMESPACE */
  594. /* ////////////////////////////////////////////////////////////////////// */
  595. #endif /* !WINSTL_INCL_WINSTL_SHIMS_ACCESS_STRING_HPP_HWND */
  596. /* ///////////////////////////// end of file //////////////////////////// */