forked from libnui/nui3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nglMimeSource.h
77 lines (54 loc) · 1.61 KB
/
nglMimeSource.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
NUI3 - C++ cross-platform GUI framework for OpenGL based applications
Copyright (C) 2002-2003 Sebastien Metrot
licence: see nui3/LICENCE.TXT
*/
/*!
\file nglMimeSource.h
\brief Portable MIME data handling
*/
#ifndef __nglMimeSource_h__
#define __nglMimeSource_h__
#include "nglString.h"
class NGL_API nglMimeSource
{
friend class nglClipBoard;
public:
#ifdef _WIN32_
typedef UINT nglMimeDataType;
#elif defined(_UNIX_)
typedef uint nglMimeDataType;
#elif defined(_CARBON_)
typedef FlavorType nglMimeDataType;
#else
typedef int nglMimeDataType;
#endif
static const nglMimeDataType TextMimeData;
static nglMimeSource::nglMimeDataType Register(const nglString &mimeType);
public:
nglMimeSource(const nglMimeSource::nglMimeDataType &mimeType);
virtual ~nglMimeSource();
const nglMimeDataType &GetMimeType() const { return mMimeType; } ///< Returns the mime source's globally unique MIME id.
protected:
virtual const uint8 *GetData() const = 0;
virtual nglSize GetDataSize() const = 0;
virtual void SetData(const uint8 *data, nglSize length) = 0;
private:
nglMimeDataType mMimeType;
};
class NGL_API nglMimeTextSource : public nglMimeSource
{
public:
nglMimeTextSource(const nglString & str = nglString::Empty);
virtual ~nglMimeTextSource();
virtual nglString GetText() const;
virtual void SetText(const nglString& str);
protected:
virtual const uint8 *GetData() const ;
virtual nglSize GetDataSize() const;
virtual void SetData(const uint8 *data, nglSize length);
private:
char* mpTextUtf8;
nglSize mLength;
};
#endif // __nglMimeSource_h__