InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StringNumeric.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Michael Easter
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //
23 // Description:
24 // This namespace provides string to numeric and numeric to string conversion routines.
25 //
26 //========================================================================================
27 
28 #ifndef __StringNumeric__
29 #define __StringNumeric__
30 
31 // ----- Includes -----
32 
33 class PMReal;
34 class WideString;
35 
36 
40 namespace stringnumeric
41 {
48  void ToWstring(const WideString& src, std::wstring& dest);
49 
57  inline std::wstring ToWstring(const WideString& src)
58  {
59  std::wstring result;
60  ToWstring(src, result);
61  return result;
62  }
63 
73  template<typename T>
74  ErrorCode FromString(const WideString& str, T& num);
75 
84  template<typename T>
85  ErrorCode FromString(const WideString& str, int32 precision, T& num);
86 
95  template<>
96  ErrorCode FromString<PMReal>(const WideString& str, int32 precision, PMReal& num);
97 
105  template<typename T>
106  ErrorCode ToString(T num, WideString& str);
107 
116  template<typename T>
117  ErrorCode ToString(T num, int32 precision, WideString& str);
118 
127  template<>
128  ErrorCode ToString<PMReal>(PMReal num, int32 precision, WideString& str);
129 
130 } // namespace stringnumeric
131 
132 #endif // __StringNumeric__