aboutsummaryrefslogtreecommitdiff
path: root/src/stable/string.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/stable/string.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/stable/string.h b/src/stable/string.h
index 82b903b..c92a704 100644
--- a/src/stable/string.h
+++ b/src/stable/string.h
@@ -946,12 +946,21 @@ namespace Bu
946 void flatten() const; 946 void flatten() const;
947 bool isFlat() const; 947 bool isFlat() const;
948 948
949 public:
950 class FormatProxyEndAction
951 {
952 public:
953 virtual void operator()( const Bu::String &sFinal )=0;
954 };
955
949 class FormatProxy 956 class FormatProxy
950 { 957 {
958 friend class Bu::String;
959 private:
960 FormatProxy( const String &rFmt, FormatProxyEndAction *pAct=NULL );
961
951 public: 962 public:
952 FormatProxy( const String &rFmt );
953 virtual ~FormatProxy(); 963 virtual ~FormatProxy();
954
955 template<typename T> 964 template<typename T>
956 FormatProxy &arg( const T &x ) 965 FormatProxy &arg( const T &x )
957 { 966 {
@@ -968,7 +977,8 @@ namespace Bu
968 return *this; 977 return *this;
969 } 978 }
970 979
971 operator String() const; 980 String end() const;
981 operator String() const { return end(); }
972 982
973 private: 983 private:
974 const String &rFmt; 984 const String &rFmt;
@@ -993,20 +1003,32 @@ namespace Bu
993 }; 1003 };
994 typedef Bu::List<Arg> ArgList; 1004 typedef Bu::List<Arg> ArgList;
995 ArgList lArgs; 1005 ArgList lArgs;
1006 FormatProxyEndAction *pAct;
1007 mutable bool bOpen;
996 }; 1008 };
997 1009
998 public: 1010 public:
999 template<typename ArgType> 1011 template<typename ArgType>
1000 FormatProxy arg( const ArgType &x ) 1012 FormatProxy arg( const ArgType &x ) const
1001 { 1013 {
1002 return FormatProxy( *this ).arg( x ); 1014 return FormatProxy( *this ).arg( x );
1003 } 1015 }
1004 1016
1005 template<typename ArgType> 1017 template<typename ArgType>
1006 FormatProxy arg( const ArgType &x, const Bu::Fmt &f ) 1018 FormatProxy arg( const ArgType &x, const Bu::Fmt &f ) const
1007 { 1019 {
1008 return FormatProxy( *this ).arg( x, f ); 1020 return FormatProxy( *this ).arg( x, f );
1009 } 1021 }
1022
1023 FormatProxy format() const
1024 {
1025 return FormatProxy( *this );
1026 }
1027
1028 FormatProxy format( FormatProxyEndAction *pEndAction ) const
1029 {
1030 return FormatProxy( *this, pEndAction );
1031 }
1010 }; 1032 };
1011 1033
1012 template<class T> String operator+( const T *pLeft, const String &rRight ) 1034 template<class T> String operator+( const T *pLeft, const String &rRight )