blob: 4221de0c472820c751631cc06eb8b8328171f31e (
plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
/***************************************************************************
charcolumninterface.h - description
-------------------
begin : Fri Sep 12 2003
copyright : (C) 2003 by Friedrich W. H. Kossebau
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License version 2 as published by the Free Software Foundation. *
* *
***************************************************************************/
#ifndef CHARCOLUMNINTERFACE_H
#define CHARCOLUMNINTERFACE_H
#include <tqstring.h>
namespace KHE
{
/**
* @short A simple interface for the access to the char column of a hex edit widget
*
* @author Friedrich W. H. Kossebau <[email protected]>
* @see createBytesEditWidget(), charColumnInterface()
* @since 3.2
*/
class CharColumnInterface
{
public:
/** encoding used to display the symbols in the text column */
enum KEncoding
{
/** the encoding of your shell. If that is a multibyte encoding this will default to Latin1. */
LocalEncoding=0,
/** extended ASCII encoding, also known as Latin1 */
ISO8859_1Encoding=1,
/** @internal not implemented: the most common EBCDIC codepage */
CECP1047Encoding=2,
/** @internal enables extension without breaking binary compatibility */
MaxEncodingId=0xFFFF
};
public: // set methods
/** sets whether "unprintable" chars (value<32) should be displayed in the text column
* with their corresponding character.
* Default is @c false.
* @param SU
* @see showUnprintable()
*/
virtual void setShowUnprintable( bool SU = true ) = 0;
/** sets the substitute character for "unprintable" chars
* Default is '.'.
* @param SC new character
* @see substituteChar()
*/
virtual void setSubstituteChar( TQChar SC ) = 0;
/** sets the encoding of the text column.
* If the encoding is not available the format will not be changed.
* Default is @c LocalEncoding.
* @param C the new encoding
* @see encoding()
*/
virtual void setEncoding( KEncoding C ) = 0;
public: // get methods
/** @return @c true if "unprintable" chars (value<32) are displayed in the text column
* with their corresponding character, @c false otherwise
* @see setShowUnprintable()
*/
virtual bool showUnprintable() const = 0;
/** @return the currently used substitute character for "unprintable" chars.
* @see setSubstituteChar()
*/
virtual TQChar substituteChar() const = 0;
/** @return the currently used encoding
* @see setEncoding()
*/
virtual KEncoding encoding() const = 0;
};
/** tries to get the charcolumn interface of t
* @return a pointer to the interface, otherwise 0
* @author Friedrich W. H. Kossebau <[email protected]>
* @since 3.2
*/
template<class T>
CharColumnInterface *charColumnInterface( T *t )
{
if( !t )
return 0;
return static_cast<CharColumnInterface*>( t->qt_cast("KHE::CharColumnInterface") );
}
}
#endif
|