diff options
Diffstat (limited to 'libtdeedu/tdeeducore')
-rw-r--r-- | libtdeedu/tdeeducore/Makefile.am | 17 | ||||
-rw-r--r-- | libtdeedu/tdeeducore/keduvocdata.cpp | 111 | ||||
-rw-r--r-- | libtdeedu/tdeeducore/keduvocdata.h | 51 | ||||
-rw-r--r-- | libtdeedu/tdeeducore/tdeeducore.kdevprj | 84 | ||||
-rw-r--r-- | libtdeedu/tdeeducore/tests/Makefile.am | 10 | ||||
-rw-r--r-- | libtdeedu/tdeeducore/tests/loader.cpp | 7 |
6 files changed, 280 insertions, 0 deletions
diff --git a/libtdeedu/tdeeducore/Makefile.am b/libtdeedu/tdeeducore/Makefile.am new file mode 100644 index 00000000..70907966 --- /dev/null +++ b/libtdeedu/tdeeducore/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES= $(all_includes) +# there's nothing in tests for the moment, so I'm removing it from the compilation +#SUBDIRS = . tests +SUBDIRS = . + +lib_LTLIBRARIES = libtdeeducore.la + +libtdeeducore_la_SOURCES = keduvocdata.cpp +libtdeeducore_la_LDFLAGS = $(all_libraries) -no-undefined -version-info 3:0:2 + +libtdeeducode_includedir = $(includedir)/libtdeedu +libtdeeducode_include_HEADERS = keduvocdata.h + +libtdeeducore_la_LIBADD = $(LIB_TDECORE) + +METASOURCES = AUTO + diff --git a/libtdeedu/tdeeducore/keduvocdata.cpp b/libtdeedu/tdeeducore/keduvocdata.cpp new file mode 100644 index 00000000..ca289f7d --- /dev/null +++ b/libtdeedu/tdeeducore/keduvocdata.cpp @@ -0,0 +1,111 @@ +/* This file is part of the KDE Edu Library + Copyright (C) 2002 Scott Wheeler <wheeler@kde.org> + + 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. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "keduvocdata.h" + +#include <tqfile.h> + +#include <kdebug.h> + +//////////////////////////////////////////////////////////////////////////////// +// class KEduVocDataItem +//////////////////////////////////////////////////////////////////////////////// + +// public methods + +KEduVocDataItem::KEduVocDataItem() +{ + +} + +KEduVocDataItem::KEduVocDataItem(TQDomElement &entry) +{ + domElement = entry; +} + +KEduVocDataItem::~KEduVocDataItem() +{ + +} + +TQString KEduVocDataItem::originalText() const +{ + return getText("o"); +} + +TQString KEduVocDataItem::translatedText() const +{ + return getText("t"); +} + +// protected methods + +TQString KEduVocDataItem::getText(const TQString &tagName) const +{ + if(!domElement.isNull()) { + + TQDomNodeList list = domElement.elementsByTagName(tagName); + + if(list.count() > 0) { + + TQDomElement element = list.item(0).toElement(); + + if(!element.isNull()) { + return element.text(); + } + else + return TQString(); + } + else + return TQString(); + } + else + return TQString(); +} + +//////////////////////////////////////////////////////////////////////////////// +// class KEduVocData +//////////////////////////////////////////////////////////////////////////////// + +// public static methods + +KEduVocDataItemList KEduVocData::parse(const TQString &fileName) +{ + KEduVocDataItemList list; + + TQDomDocument document; + TQFile file(fileName); + document.setContent(&file); + + TQDomNodeList entries = document.elementsByTagName("e"); + + // loop through the "e" (entry) tags looking for data + for(uint i = 0 ; i < entries.count() ; i++) { + + // get an entry to operate on + TQDomElement entry = entries.item(i).toElement(); + + // if the "node" is in fact an element -- i.e. not null + if(!entry.isNull()) { + KEduVocDataItem item(entry); + list.append(item); + } + } + + return list; +} diff --git a/libtdeedu/tdeeducore/keduvocdata.h b/libtdeedu/tdeeducore/keduvocdata.h new file mode 100644 index 00000000..b8ac6676 --- /dev/null +++ b/libtdeedu/tdeeducore/keduvocdata.h @@ -0,0 +1,51 @@ +/* This file is part of the KDE Edu Library + Copyright (C) 2002 Scott Wheeler <wheeler@kde.org> + + 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. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef KEDUVOCDATA_H +#define KEDUVOCDATA_H + +#include <tqdom.h> +#include <tqvaluelist.h> +#include <kdemacros.h> + +class KDE_EXPORT KEduVocDataItem +{ +public: + KEduVocDataItem(); + KEduVocDataItem(TQDomElement &entry); + virtual ~KEduVocDataItem(); + + TQString originalText() const; + TQString translatedText() const; + +protected: + TQString getText(const TQString &tagName) const; + +private: + TQDomElement domElement; +}; + +typedef TQValueList<KEduVocDataItem> KEduVocDataItemList; + +class KDE_EXPORT KEduVocData +{ +public: + static KEduVocDataItemList parse(const TQString &fileName); +}; + +#endif // KEDUVOCDATA_H diff --git a/libtdeedu/tdeeducore/tdeeducore.kdevprj b/libtdeedu/tdeeducore/tdeeducore.kdevprj new file mode 100644 index 00000000..5cd1dc62 --- /dev/null +++ b/libtdeedu/tdeeducore/tdeeducore.kdevprj @@ -0,0 +1,84 @@ +[./Makefile.am] +files=./tdeeducore.kdevprj, +sub_dirs= +type=normal + +[./tdeeducore.kdevprj] +dist=true +install=false +install_location= +type=DATA + +[Config for BinMakefileAm] +addcxxflags= +bin_program=tdeeducore +cflags= +cppflags= +cxxflags=\s-O0 +ldadd= +ldflags=\s +libtool_dir= +path_to_bin_program=. + +[General] +author=earnold +configure_args=\s--build=i386-linux --host=i386-linux --target=i386-linux\s +dir_where_make_will_be_called= +email=earnold@venus +kdevprj_version=1.3 +lfv_open_groups= +make_options=\s-j1 all\s +makefiles=./Makefile.am,Makefile.am,tests/Makefile.am +modifyMakefiles=false +project_name=tdeeducore +project_type=normal_empty +short_info= +sub_dir= +version=1.0 +version_control=CVS +workspace=1 + +[LFV Groups] +GNU=AUTHORS,COPYING,ChangeLog,INSTALL,README,TODO,NEWS, +Headers=*.h,*.hxx,*.hpp,*.H, +Others=*, +Sources=*.cpp,*.c,*.cc,*.C,*.cxx,*.ec,*.ecpp,*.lxx,*.l++,*.ll,*.l, +Translations=*.ts,*.po, +User Interface=*.ui,*.kdevdlg,*.rc, +groups=Headers,Sources,GNU,Translations,User Interface,Others + +[Makefile.am] +dist=true +files=Makefile.am,kedudata.cpp,kedudata.h +install=false +install_location= +sub_dirs=tests +type=static_library + +[kedudata.cpp] +dist=true +install=false +install_location= +type=SOURCE + +[kedudata.h] +dist=true +install=false +install_location= +type=HEADER + +[tests/Makefile.am] +dist=true +files=tests/loader.cpp,tests/Makefile.am +install=false +install_location= +sharedlib_LDFLAGS=-version-info 0:0:0 +sharedlib_rootname=tests +sub_dirs= +type=DATA + +[tests/loader.cpp] +dist=true +install=false +install_location= +type=SOURCE diff --git a/libtdeedu/tdeeducore/tests/Makefile.am b/libtdeedu/tdeeducore/tests/Makefile.am new file mode 100644 index 00000000..df1a67b8 --- /dev/null +++ b/libtdeedu/tdeeducore/tests/Makefile.am @@ -0,0 +1,10 @@ +SUBDIRS = . +INCLUDES = -I. -I$(top_srcdir)/tdeeducore $(all_includes) + +check_PROGRAMS = loader + +#all: check + +loader_SOURCES = loader.cpp +loader_LDFLAGS = $(all_libraries) +loader_LDADD = ../libtdeeducore.la diff --git a/libtdeedu/tdeeducore/tests/loader.cpp b/libtdeedu/tdeeducore/tests/loader.cpp new file mode 100644 index 00000000..8d793ca4 --- /dev/null +++ b/libtdeedu/tdeeducore/tests/loader.cpp @@ -0,0 +1,7 @@ + +int main (void) +{ + + + return 0; +} |