xref: /haiku/src/add-ons/translators/stxt/STXTTranslator.h (revision 9949213a25979d177b420bc71891c2bff02a331d)
1*9949213aSStephan Aßmus /*****************************************************************************/
2*9949213aSStephan Aßmus // STXTTranslator
3*9949213aSStephan Aßmus // Written by Michael Wilber, OBOS Translation Kit Team
4*9949213aSStephan Aßmus //
5*9949213aSStephan Aßmus // STXTTranslator.h
6*9949213aSStephan Aßmus //
7*9949213aSStephan Aßmus // This BTranslator based object is for opening and writing
8*9949213aSStephan Aßmus // StyledEdit (STXT) files.
9*9949213aSStephan Aßmus //
10*9949213aSStephan Aßmus //
11*9949213aSStephan Aßmus // Copyright (c) 2002 OpenBeOS Project
12*9949213aSStephan Aßmus //
13*9949213aSStephan Aßmus // Permission is hereby granted, free of charge, to any person obtaining a
14*9949213aSStephan Aßmus // copy of this software and associated documentation files (the "Software"),
15*9949213aSStephan Aßmus // to deal in the Software without restriction, including without limitation
16*9949213aSStephan Aßmus // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17*9949213aSStephan Aßmus // and/or sell copies of the Software, and to permit persons to whom the
18*9949213aSStephan Aßmus // Software is furnished to do so, subject to the following conditions:
19*9949213aSStephan Aßmus //
20*9949213aSStephan Aßmus // The above copyright notice and this permission notice shall be included
21*9949213aSStephan Aßmus // in all copies or substantial portions of the Software.
22*9949213aSStephan Aßmus //
23*9949213aSStephan Aßmus // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24*9949213aSStephan Aßmus // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25*9949213aSStephan Aßmus // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26*9949213aSStephan Aßmus // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27*9949213aSStephan Aßmus // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28*9949213aSStephan Aßmus // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29*9949213aSStephan Aßmus // DEALINGS IN THE SOFTWARE.
30*9949213aSStephan Aßmus /*****************************************************************************/
31*9949213aSStephan Aßmus 
32*9949213aSStephan Aßmus #ifndef STXT_TRANSLATOR_H
33*9949213aSStephan Aßmus #define STXT_TRANSLATOR_H
34*9949213aSStephan Aßmus 
35*9949213aSStephan Aßmus #include <Translator.h>
36*9949213aSStephan Aßmus #include <TranslatorFormats.h>
37*9949213aSStephan Aßmus #include <TranslationDefs.h>
38*9949213aSStephan Aßmus #include <GraphicsDefs.h>
39*9949213aSStephan Aßmus #include <InterfaceDefs.h>
40*9949213aSStephan Aßmus #include <DataIO.h>
41*9949213aSStephan Aßmus #include <File.h>
42*9949213aSStephan Aßmus #include <ByteOrder.h>
43*9949213aSStephan Aßmus #include <fs_attr.h>
44*9949213aSStephan Aßmus #include "BaseTranslator.h"
45*9949213aSStephan Aßmus 
46*9949213aSStephan Aßmus #define STXT_TRANSLATOR_VERSION B_TRANSLATION_MAKE_VERSION(1,0,0)
47*9949213aSStephan Aßmus #define STXT_IN_QUALITY 0.5
48*9949213aSStephan Aßmus #define STXT_IN_CAPABILITY 0.5
49*9949213aSStephan Aßmus #define STXT_OUT_QUALITY 0.5
50*9949213aSStephan Aßmus #define STXT_OUT_CAPABILITY 0.5
51*9949213aSStephan Aßmus 
52*9949213aSStephan Aßmus #define TEXT_IN_QUALITY 0.4
53*9949213aSStephan Aßmus #define TEXT_IN_CAPABILITY 0.6
54*9949213aSStephan Aßmus #define TEXT_OUT_QUALITY 0.4
55*9949213aSStephan Aßmus #define TEXT_OUT_CAPABILITY 0.6
56*9949213aSStephan Aßmus 
57*9949213aSStephan Aßmus class STXTTranslator : public BaseTranslator {
58*9949213aSStephan Aßmus public:
59*9949213aSStephan Aßmus 	STXTTranslator();
60*9949213aSStephan Aßmus 
61*9949213aSStephan Aßmus 	virtual status_t Identify(BPositionIO *inSource,
62*9949213aSStephan Aßmus 		const translation_format *inFormat, BMessage *ioExtension,
63*9949213aSStephan Aßmus 		translator_info *outInfo, uint32 outType);
64*9949213aSStephan Aßmus 		// determines whether or not this translator can convert the
65*9949213aSStephan Aßmus 		// data in inSource to the type outType
66*9949213aSStephan Aßmus 
67*9949213aSStephan Aßmus 	virtual status_t Translate(BPositionIO *inSource,
68*9949213aSStephan Aßmus 		const translator_info *inInfo, BMessage *ioExtension,
69*9949213aSStephan Aßmus 		uint32 outType, BPositionIO *outDestination);
70*9949213aSStephan Aßmus 		// this function is the whole point of the Translation Kit,
71*9949213aSStephan Aßmus 		// it translates the data in inSource to outDestination
72*9949213aSStephan Aßmus 		// using the format outType
73*9949213aSStephan Aßmus 
74*9949213aSStephan Aßmus 	virtual BView *NewConfigView(TranslatorSettings *settings);
75*9949213aSStephan Aßmus 
76*9949213aSStephan Aßmus protected:
77*9949213aSStephan Aßmus 	virtual ~STXTTranslator();
78*9949213aSStephan Aßmus 		// this is protected because the object is deleted by the
79*9949213aSStephan Aßmus 		// Release() function instead of being deleted directly by
80*9949213aSStephan Aßmus 		// the user
81*9949213aSStephan Aßmus 
82*9949213aSStephan Aßmus private:
83*9949213aSStephan Aßmus };
84*9949213aSStephan Aßmus 
85*9949213aSStephan Aßmus #endif // #ifndef STXT_TRANSLATOR_H
86