NCBI C++ ToolKit
string_formatters.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: string_formatters.cpp 47479 2023-05-02 13:24:02Z ucko $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Authors: Andrey Yazhuk
27 *
28 * File Description:
29 *
30 */
31 #include <ncbi_pch.hpp>
32 
33 #include <corelib/ncbistr.hpp>
34 
37 
38 
40 
41 wxString IwxStringFormat::Format( wxVariant& aVar ) const
42 {
43  wxString rv;
44  Format( aVar, rv );
45 
46  return rv;
47 }
48 
49 void CwxIntPrintfFormat::Format( wxVariant& aVar, wxString& aStr, bool afAppend ) const
50 {
51  if( afAppend ){
52  aStr += wxString::Format( m_Format, aVar.GetInteger() );
53  } else {
54  aStr.Printf( m_Format, aVar.GetInteger() );
55  }
56 }
57 
58 void CwxDoublePrintfFormat::Format( wxVariant& aVar, wxString& aStr, bool afAppend ) const
59 {
60  if( afAppend ){
61  aStr += wxString::Format( m_Format, aVar.GetDouble() );
62  } else {
63  aStr.Printf( m_Format, aVar.GetDouble() );
64  }
65 }
66 
67 void CwxIntWithFlagsFormat::Format( wxVariant& aVar, wxString& aStr, bool afAppend ) const
68 {
69  auto i = aVar.GetInteger();
70  if( afAppend ){
72  } else {
74  }
75 }
76 
virtual void Format(wxVariant &aVar, wxString &aStr, bool afAppend=false) const
virtual void Format(wxVariant &aVar, wxString &aStr, bool afAppend=false) const
virtual void Format(wxVariant &aVar, wxString &aStr, bool afAppend=false) const
virtual wxString Format(wxVariant &aVar) const
The NCBI C++ standard methods for dealing with std::string.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
Definition: ncbistr.hpp:673
int i
Format
Definition: njn_ioutil.hpp:52
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
Modified on Wed Feb 28 07:12:04 2024 by modify_doxy.py rev. 669887