34 #ifndef BOOST_FILESYSTEM_VERSION
35 #define BOOST_FILESYSTEM_VERSION 2
37 #include <boost/filesystem.hpp>
39 #include "WExportCommon.h"
45 inline bool isBigEndian()
51 } some = {0x01020305};
53 return some.c[0] == 1;
62 template<
class T > T switchByteOrder(
const T value )
64 size_t numBytes =
sizeof( T );
70 WAssert( numBytes % 2 == 0 && numBytes > 0,
"odd number of bytes whilte switching byte order" );
71 char *s =
reinterpret_cast< char*
>( &result );
72 for(
size_t i = 0; i < numBytes / 2; ++i )
74 std::swap( s[i], s[ ( numBytes - 1 ) - i ] );
87 template<
class T >
void switchByteOrderOfArray( T *array,
const size_t arraySize )
89 for(
size_t i = 0; i < arraySize; ++i )
91 array[i] = switchByteOrder< T >( array[i] );
99 inline std::string getSuffix( std::string name )
101 return boost::filesystem::path( name ).extension();
109 inline bool fileExists(
const std::string& name )
111 return boost::filesystem::exists( boost::filesystem::path( name ) );
118 boost::filesystem::path tempFileName();
131 std::string OWCOMMON_EXPORT readFileIntoString(
const boost::filesystem::path& path );
144 std::string OWCOMMON_EXPORT readFileIntoString(
const std::string& name );
154 void OWCOMMON_EXPORT writeStringIntoFile(
const boost::filesystem::path& path,
const std::string& content );
164 void OWCOMMON_EXPORT writeStringIntoFile(
const std::string& name,
const std::string& content );