filters
config.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <kdebug.h>
00023 #include "config.h"
00024
00025
00026 const char Config::SPACE_CHAR = ' ';
00027 Config* Config::_instance = 0;
00028
00029
00030
00031
00032 Config::Config()
00033 {
00034 _tabSize = 4;
00035 _tabulation = 0;
00036 _useLatexStyle = true;
00037 _isEmbeded = false;
00038 _convertPictures = false;
00039 }
00040
00041 Config::Config(const Config &config)
00042 {
00043 setTabSize(config.getTabSize());
00044 setIndentation(config.getIndentation());
00045 setClass(config.getClass());
00046 setEmbeded(config.isEmbeded());
00047
00048 setEncoding(config.getEncoding());
00049 if(config.isKwordStyleUsed()) useKwordStyle();
00050 }
00051
00052
00053
00054
00055 Config::~Config()
00056 {
00057 }
00058
00059 void Config::indent()
00060 {
00061 kdDebug(30522) << "Indent tab = " << (_tabulation + getTabSize()) << endl;
00062 _tabulation = _tabulation + getTabSize();
00063 }
00064
00065 void Config::desindent()
00066 {
00067 if ((_tabulation - getTabSize()) > 0)
00068 {
00069 kdDebug(30522) << "Desindent tab = " << (_tabulation - getTabSize()) << endl;
00070 _tabulation = _tabulation - getTabSize();
00071 }
00072 else
00073 {
00074 kdDebug(30522) << "Desindent tab = 0" << endl;
00075 _tabulation = 0;
00076 }
00077 }
00078
00079 void Config::writeIndent(QTextStream& out)
00080 {
00081 for(int index = 0; index < _tabulation; index++)
00082 {
00083 out << " ";
00084 }
00085 }
00086
00087 Config* Config::instance()
00088 {
00089 if(_instance == 0)
00090 _instance = new Config();
00091 return _instance;
00092 }
|