34 #include <boost/filesystem.hpp>
43 inline bool isBigEndian()
49 } some = {0x01020305};
51 return some.c[0] == 1;
60 template<
class T > T switchByteOrder(
const T value )
62 size_t numBytes =
sizeof( T );
68 WAssert( numBytes % 2 == 0 && numBytes > 0,
"odd number of bytes whilte switching byte order" );
69 char *s =
reinterpret_cast< char*
>( &result );
70 for(
size_t i = 0; i < numBytes / 2; ++i )
72 std::swap( s[i], s[ ( numBytes - 1 ) - i ] );
85 template<
class T >
void switchByteOrderOfArray( T *array,
const size_t arraySize )
87 for(
size_t i = 0; i < arraySize; ++i )
89 array[i] = switchByteOrder< T >( array[i] );
97 inline std::string getSuffix( boost::filesystem::path name )
99 return name.extension().string();
106 inline std::string getSuffix( std::string name )
108 return getSuffix( boost::filesystem::path( name ) );
116 inline bool fileExists(
const std::string& name )
118 return boost::filesystem::exists( boost::filesystem::path( name ) );
134 boost::filesystem::path tempFilename( boost::filesystem::path model =
"%%%%%%%%" );
147 std::string readFileIntoString(
const boost::filesystem::path& path );
160 std::string readFileIntoString(
const std::string& name );
170 void writeStringIntoFile(
const boost::filesystem::path& path,
const std::string& content );
180 void writeStringIntoFile(
const std::string& name,
const std::string& content );
#define OW_API_DEPRECATED
In order to mark functions for the compiler as deprecated we need to put this before each deprecated ...