xref: /haiku/src/add-ons/kernel/file_systems/udf/DString.h (revision 1e36cfc2721ef13a187c6f7354dc9cbc485e89d3)
1 //----------------------------------------------------------------------
2 //  This software is part of the OpenBeOS distribution and is covered
3 //  by the OpenBeOS license.
4 //
5 //  Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
6 //---------------------------------------------------------------------
7 
8 #ifndef _D_STRING_H
9 #define _D_STRING_H
10 
11 #include "kernel_cpp.h"
12 #include "UdfString.h"
13 #include "UdfDebug.h"
14 
15 namespace Udf {
16 
17 /*! \brief Fixed-length d-string class that takes a Udf::String as input
18 	and provides a properly formatted ECMA-167 d-string of the given
19 	field length as ouput.
20 
21 	For d-string info, see: ECMA-167 1/7.2.12, UDF-2.50 2.1.3
22 */
23 class DString {
24 public:
25 	DString();
26 	DString(const DString &ref);
27 	DString(const Udf::String &string, uint8 fieldLength);
28 	DString(const char *utf8, uint8 fieldLength);
29 
30 	void SetTo(const DString &ref);
31 	void SetTo(const Udf::String &string, uint8 fieldLength);
32 	void SetTo(const char *utf8, uint8 fieldLength);
33 
34 	const uint8* String() const { return fString; }
35 	uint8 Length() const { return fLength; }
36 private:
37 	void _Clear();
38 
39 	uint8 *fString;
40 	uint8 fLength;
41 };
42 
43 };	// namespace UDF
44 
45 
46 
47 #endif	// _D_STRING_H
48