35 #include <AK/Tools/Common/AkPlatformFuncs.h>
70 return ReadBytes( &out_data,
sizeof( T ), cRead );
91 wchar_t * out_pszString,
95 if ( !Read<AkInt32>( cChars ) )
104 if ( cChars < in_nMax )
106 ReadBytes( out_pszString, cChars *
sizeof(
wchar_t ), cRead );
107 out_pszString[ cChars ] = 0;
109 bRet = cRead == (AkInt32)( cChars *
sizeof(
wchar_t ) );
113 ReadBytes( out_pszString, in_nMax *
sizeof(
wchar_t ), cRead );
114 out_pszString[ in_nMax - 1 ] = 0;
116 bRet = cRead == (AkInt32)( in_nMax *
sizeof(
wchar_t));
121 AkInt32 cRemaining = cChars - in_nMax;
123 wchar_t * pTemp =
new wchar_t[ cRemaining ];
125 ReadBytes( pTemp, cRemaining *
sizeof(
wchar_t ), cRead );
127 bRet = cRead == (AkInt32)(cRemaining *
sizeof(
wchar_t));
135 out_pszString[ 0 ] = 0;
155 const void * in_pData,
157 AkInt32 & out_cWritten
174 return WriteBytes( &in_data,
sizeof( T ), cWritten );
180 const wchar_t * in_pszString )
182 if ( in_pszString != NULL )
184 size_t cChars = wcslen( in_pszString );
185 if ( !Write<AkUInt32>( (AkUInt32) cChars ) )
188 AkInt32 cWritten = 0;
189 AkInt32 cToWrite = (AkInt32)( cChars *
sizeof(
wchar_t ) );
193 WriteBytes( in_pszString, cToWrite, cWritten );
196 return cWritten == cToWrite;
198 return Write<AkUInt32>( 0 );
204 const char * in_pszString )
206 if ( in_pszString != NULL )
208 size_t cChars = strlen( in_pszString );
209 if ( !Write<AkUInt32>( (AkUInt32) cChars ) )
212 AkInt32 cWritten = 0;
216 WriteBytes( in_pszString, (AkInt32) cChars, cWritten );
219 return cWritten == (AkInt32) cChars;
221 return Write<AkUInt32>( 0 );
241 virtual AkUInt8 *
Bytes()
const = 0;
248 virtual bool Reserve( AkInt32 in_cBytes ) = 0;
260 #endif // _AK_IBYTES_H
virtual AkUInt8 * Detach()=0
Return pointer to buffer and clear internal pointer.
bool WriteString(const char *in_pszString)
bool ReadString(wchar_t *out_pszString, AkInt32 in_nMax)
virtual bool Reserve(AkInt32 in_cBytes)=0
virtual void SetCount(AkInt32 in_cBytes)=0
Set number of bytes written.
virtual bool WriteBytes(const void *in_pData, AkInt32 in_cBytes, AkInt32 &out_cWritten)=0
bool Write(const T &in_data)
virtual bool ReadBytes(void *in_pData, AkInt32 in_cBytes, AkInt32 &out_cRead)=0
bool WriteString(const wchar_t *in_pszString)
virtual AkInt32 Count() const =0
virtual AkUInt8 * Bytes() const =0
virtual void Clear()=0
Clear the buffer contents.
あなたのプロジェクトについて教えてください。ご不明な点はありませんか。
プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。
Wwiseからはじめよう