CrossFramework Library

XBase/ShortStringFactory.hpp

説明を見る。
00001 
00006 #if defined(XBASE_INCLUDED_SHORTSTRINGFACTORY)
00007 #else
00008 #define XBASE_INCLUDED_SHORTSTRINGFACTORY
00009 
00010 //------------------------------------------------------------
00011 #include <XBase/BuiltInTypes.hpp>
00012 #include <XBase/ShortString.hpp>
00013 #include <XBase/TypeTraits.hpp>
00014 
00015 //------------------------------------------------------------
00016 namespace XBase {
00017 
00018     // ShortStringを作る関数群。
00019     class ShortStringFactory
00020     {
00021     public:
00022         // 特殊化された関数達。
00023         static const ::XBase::ShortString Create( bool aVal );
00024         static const ::XBase::ShortString Create( int aVal );
00025         static const ::XBase::ShortString Create( f32 aVal );
00026         static const ::XBase::ShortString Create( f64 aVal );
00027         static const ::XBase::ShortString Create( s8 aVal );
00028         static const ::XBase::ShortString Create( s16 aVal );
00029         static const ::XBase::ShortString Create( s32 aVal );
00030         static const ::XBase::ShortString Create( s64 aVal );
00031         static const ::XBase::ShortString Create( u8 aVal );
00032         static const ::XBase::ShortString Create( u16 aVal );
00033         static const ::XBase::ShortString Create( u32 aVal );
00034         static const ::XBase::ShortString Create( u64 aVal );
00035         static const ::XBase::ShortString Create( ptr_t aVal );
00036         static const ::XBase::ShortString Create( const_ptr_t aVal );
00037         static const ::XBase::ShortString Create( anyptr_t aVal );
00038         static const ::XBase::ShortString Create( const_anyptr_t aVal );
00039         static const ::XBase::ShortString Create( const char* aVal );
00040         
00041         // デフォルトの実装。toShortString関数を使う。
00042         template< typename T , class Cond = void >
00043         class Impl
00044         {
00045         public:            
00046             static const ::XBase::ShortString Create( const T& aObj )
00047             {
00048                 return aObj.toShortString();
00049             }
00050         };
00051                 
00052         // 特殊化できなかったものは、Implに委譲。
00053         template< typename T >
00054         static const ::XBase::ShortString Create( const T& aObj )
00055         {
00056             return Impl< T >::Create( aObj );
00057         };
00058     };
00059 
00060 }
00061 //------------------------------------------------------------
00062 #endif
00063 // EOF
 全て クラス ネームスペース ファイル 関数 変数 型定義 列挙型 列挙型の値 マクロ定義