Back

1     //------------------------------------------------------------------------------
2     // Module Languages.cpp                                                       //
3     //                                                                            //
4     //    Class which encapsulates several TLanguage objects                      //
5     //                                                                            //
6     //    Copyright (c) 2004 by Lars Haendel                                      //
7     //    Home: http://www.newty.de                                               //
8     //                                                                            //
9     //    This program is free software; you can redistribute it and/or modify    //
10    //    it under the terms of the GNU General Public License as published by    //
11    //    the Free Software Foundation as version 2 of the License.               //
12    //                                                                            //
13    //    This program is distributed in the hope that it will be useful,         //
14    //    but WITHOUT ANY WARRANTY; without even the implied warranty of          //
15    //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
16    //    GNU General Public License for more details.                            //
17    //                                                                            //
18    //    You should have received a copy of the GNU General Public License       //
19    //    along with this program; if not, write to the Free Software             //
20    //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.               //
21    //                                                                            //
22    //------------------------------------------------------------------------------
23
24
25
26    #ifndef LanguagesH
27    #define LanguagesH
28
29
30    #include <iostream>           // due to:  ifstream
31    #include <fstream>
32
33    #include "StdList.h"          //          TStdList
34    #include "Language.h"         //          TLanguage
35    #include "defines.h"          //          general defines
36
37
38    //----------------------------------------------------------------------------------------------------------------------
39    // cass which encapsulates several TLanguage objects
40    class TLangs
41    {
42    private:
43
44       TStdList<TLanguage*> langs;         // list with the language definitions
45       void Release();                     // release memory
46
47
48    public:
49
50       // constructor/destructor
51       TLangs() {};
52       ~TLangs() { Release(); };
53
54
55       // Load and Save
56       void Load(ifstream& file);
57       void Save(ofstream& file) const;
58
59       // get language
60       int Size() const { return langs.Size(); };      // get number of languages
61       const TLanguage* Get(const int& i);             // get i'th language definition
62       int GetId(const char*const& szName);            // get language definition id by name
63    };
64    #endif

Top