1/* 2 * Copyright 2003, Tyler Dauwalder, tyler@dauwalder.net. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _D_STRING_H 6#define _D_STRING_H 7 8 9#include "UdfDebug.h" 10 11#include "UdfString.h" 12 13#include <util/kernel_cpp.h> 14 15 16/*! \brief Fixed-length d-string class that takes a UdfString as input 17 and provides a properly formatted ECMA-167 d-string of the given 18 field length as ouput. 19 20 For d-string info, see: ECMA-167 1/7.2.12, UDF-2.50 2.1.3 21*/ 22class DString { 23public: 24 DString(); 25 DString(const DString &ref); 26 DString(const UdfString &string, 27 uint8 fieldLength); 28 DString(const char *utf8, uint8 fieldLength); 29 ~DString(); 30 31 uint8 Length() const { return fLength; } 32 33 void SetTo(const DString &ref); 34 void SetTo(const UdfString &string, uint8 fieldLength); 35 void SetTo(const char *utf8, uint8 fieldLength); 36 37 const uint8* String() const { return fString; } 38 39private: 40 void _Clear(); 41 42private: 43 uint8 fLength; 44 uint8 *fString; 45}; 46 47 48#endif // _D_STRING_H 49