33 #include <boost/filesystem.hpp>
41 inline bool isBigEndian()
47 } some = {0x01020305};
49 return some.c[0] == 1;
58 template<
class T > T switchByteOrder(
const T value )
60 size_t numBytes =
sizeof( T );
66 WAssert( numBytes % 2 == 0 && numBytes > 0,
"odd number of bytes whilte switching byte order" );
67 char *s =
reinterpret_cast< char*
>( &result );
68 for(
size_t i = 0; i < numBytes / 2; ++i )
70 std::swap( s[i], s[ ( numBytes - 1 ) - i ] );
83 template<
class T >
void switchByteOrderOfArray( T *array,
const size_t arraySize )
85 for(
size_t i = 0; i < arraySize; ++i )
87 array[i] = switchByteOrder< T >( array[i] );
95 inline std::string getSuffix( boost::filesystem::path name )
97 return name.extension().string();
104 inline std::string getSuffix( std::string name )
106 return getSuffix( boost::filesystem::path( name ) );
114 inline bool fileExists(
const std::string& name )
116 return boost::filesystem::exists( boost::filesystem::path( name ) );
132 boost::filesystem::path tempFilename( boost::filesystem::path model =
"%%%%%%%%" );
145 std::string readFileIntoString(
const boost::filesystem::path& path );
158 std::string readFileIntoString(
const std::string& name );
168 void writeStringIntoFile(
const boost::filesystem::path& path,
const std::string& content );
178 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 ...