#include <WOscUtil.h>
Public Types | |
| enum | Constants { OSC_INT_SIZE = 4, OSC_FLOAT_SIZE = 4 } |
Static Public Member Functions | |
| static int | GetSizeFourByteAligned (const char *string) |
| static int | GetSizeFourByteAligned (const int length) |
| static void | PadStringWithZeros (char *destString, const char *sourceString) |
| static void | PadBufferWithZeros (char *destBuffer, const char *sourceBuffer, int destLen, int srcLen) |
| template<class TYPE> | |
| static TYPE | BufferTo (const char *buffer) |
| template<class TYPE> | |
| static void | FillBufferWith (char *buffer, const TYPE &arg) |
Definition at line 51 of file WOscUtil.h.
|
|
Constants used in WOscUtil OSC-argument sizes.
Definition at line 86 of file WOscUtil.h. 00086 {
00087 OSC_INT_SIZE = 4, /**< OSC-argument integer size. */
00088 OSC_FLOAT_SIZE = 4, /**< OSC-argument float size (Changed from 8 to 4,
00089 * pointed out by Damian Stewart) . */
00090 };
|
|
|
Rounds up the given integer to the next multiple of 4. Similar to getSizeFourByteAligned(const char* string).
Definition at line 77 of file WOscUtil.cpp. 00078 {
00079 return length + ( 4 - length % 4 ) % 4;
00080 }
|
|
|
Get length of string and round up to the next multiple of 4. Gets the size of the string passed as parameter and rounds it up to the next multiple of four.
Definition at line 57 of file WOscUtil.cpp. Referenced by WOscString::operator+=(), WOscString::operator=(), PadStringWithZeros(), WOscBlob::WOscBlob(), and WOscString::WOscString(). 00058 {
00059 int length = (int)strlen(string) + 1;
00060 return length + ( 4 - length % 4 ) % 4;
00061 }
|
|
||||||||||||||||||||
|
Copies the source buffer to the destination buffer and pads the difference with zeros. The destination buffer must be large enough, i.e. destLen >= srcLen. Works for every buffer, assumed destLen >= srcLen. If destLen is smaller than srcLen only srcLen data is copied and nothing padded.
Definition at line 138 of file WOscUtil.cpp. 00140 {
00141 if ( destLen <= srcLen )
00142 memcpy(destBuffer, sourceBuffer, destLen);
00143 else {
00144 memcpy(destBuffer, sourceBuffer, srcLen);
00145 memset(destBuffer+srcLen, 0, destLen-srcLen);
00146 }
00147 }
|
|
||||||||||||
|
Copies the source string to the destination string and pads it with zeros to the next multiple of four, the destination buffer must be large enough.
Definition at line 102 of file WOscUtil.cpp. References GetSizeFourByteAligned(). Referenced by WOscString::operator=(), and WOscString::WOscString(). 00103 {
00104 int length = (int)strlen(sourceString) + 1;
00105 int osclength = GetSizeFourByteAligned(sourceString);
00106
00107 strcpy(destString, sourceString);
00108
00109 for ( int i = length; i < osclength; i++ )
00110 destString[i] = '\0';
00111 }
|
1.4.1