add 'Language' resolvables
authorKlaus Kaempf <kkaempf@suse.de>
Sat, 25 Feb 2006 10:00:24 +0000 (10:00 +0000)
committerKlaus Kaempf <kkaempf@suse.de>
Sat, 25 Feb 2006 10:00:24 +0000 (10:00 +0000)
testsuite/solver/src/helix/HelixLanguageImpl.cc [new file with mode: 0644]
testsuite/solver/src/helix/HelixLanguageImpl.h [new file with mode: 0644]
testsuite/solver/src/helix/HelixSourceImpl.cc
testsuite/solver/src/helix/HelixSourceImpl.h
testsuite/solver/src/helix/Makefile.am

diff --git a/testsuite/solver/src/helix/HelixLanguageImpl.cc b/testsuite/solver/src/helix/HelixLanguageImpl.cc
new file mode 100644 (file)
index 0000000..ef22db0
--- /dev/null
@@ -0,0 +1,38 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/testsuite/solver/HelixLanguageImpl.cc
+ *
+*/
+
+#include "HelixLanguageImpl.h"
+#include "zypp/source/SourceImpl.h"
+#include "zypp/base/String.h"
+#include "zypp/base/Logger.h"
+
+using namespace std;
+using namespace zypp::detail;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : HelixLanguageImpl
+//
+///////////////////////////////////////////////////////////////////
+
+/** Default ctor
+*/
+HelixLanguageImpl::HelixLanguageImpl (Source_Ref source_r, const zypp::HelixParser & parsed)
+{
+}
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/testsuite/solver/src/helix/HelixLanguageImpl.h b/testsuite/solver/src/helix/HelixLanguageImpl.h
new file mode 100644 (file)
index 0000000..5319e0a
--- /dev/null
@@ -0,0 +1,43 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/testsuite/solver/HelixLanguageImpl.h
+ *
+*/
+#ifndef ZYPP_HELIXLANGUAGEIMPL_H
+#define ZYPP_HELIXLANGUAGEIMPL_H
+
+#include "zypp/detail/LanguageImplIf.h"
+#include "HelixParser.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////
+//
+//        CLASS NAME : HelixLanguageImpl
+//
+/** Class representing a package
+*/
+class HelixLanguageImpl : public detail::LanguageImplIf
+{
+public:
+
+       class HelixParser;
+       /** Default ctor
+       */
+       HelixLanguageImpl( Source_Ref source_r, const zypp::HelixParser & data );
+
+protected:
+
+ };
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_HELIXLANGUAGEIMPL_H
index 7a99d62..d089907 100644 (file)
@@ -23,6 +23,7 @@
 #include "HelixSourceImpl.h"
 #include "HelixPackageImpl.h"
 #include "HelixScriptImpl.h"
+#include "HelixLanguageImpl.h"
 #include "HelixMessageImpl.h"
 #include "HelixPatchImpl.h"
 #include "HelixSelectionImpl.h"
@@ -134,6 +135,30 @@ HelixSourceImpl::createPackage (const HelixParser & parsed)
 }
 
 
+Language::Ptr
+HelixSourceImpl::createLanguage (const HelixParser & parsed)
+{
+    try
+    {
+       detail::ResImplTraits<HelixLanguageImpl>::Ptr impl(new HelixLanguageImpl(_source, parsed));
+
+       // Collect basic Resolvable data
+       NVRAD dataCollect( parsed.name,
+                       Edition( parsed.version, parsed.release, parsed.epoch ),
+                       Arch( parsed.arch ),
+                       createDependencies (parsed));
+       Language::Ptr message = detail::makeResolvableFromImpl(dataCollect, impl);
+       return message;
+    }
+    catch (const Exception & excpt_r)
+    {
+       ERR << excpt_r << endl;
+       throw "Cannot create language object";
+    }
+    return NULL;
+}
+
+
 Message::Ptr
 HelixSourceImpl::createMessage (const HelixParser & parsed)
 {
@@ -291,6 +316,10 @@ HelixSourceImpl::parserCallback (const HelixParser & parsed)
        Message::Ptr m = createMessage (parsed);
        _store.insert (m);
     }
+    else if (parsed.kind == ResTraits<Language>::kind) {
+       Language::Ptr l = createLanguage( parsed );
+       _store.insert (l);
+    }
     else if (parsed.kind == ResTraits<Script>::kind) {
        Script::Ptr s = createScript (parsed);
        _store.insert (s);
index 796de12..2e12b42 100644 (file)
@@ -19,8 +19,8 @@
  * 02111-1307, USA.
  */
 
-#ifndef ZYPP_SOLVER_TEMPORARY_HELIXSOURCEIMPL_H
-#define ZYPP_SOLVER_TEMPORARY_HELIXSOURCEIMPL_H
+#ifndef ZYPP_SOLVER_HELIXSOURCEIMPL_H
+#define ZYPP_SOLVER_HELIXSOURCEIMPL_H
 
 #include <iosfwd>
 #include <string>
@@ -30,6 +30,7 @@
 #include "HelixParser.h"
 
 #include "zypp/Package.h"
+#include "zypp/Language.h"
 #include "zypp/Message.h"
 #include "zypp/Script.h"
 #include "zypp/Patch.h"
@@ -69,6 +70,7 @@ class HelixSourceImpl : public zypp::source::SourceImpl {
 
     Package::Ptr createPackage (const HelixParser & data);
     Message::Ptr createMessage (const HelixParser & data);
+    Language::Ptr createLanguage (const HelixParser & data);
     Script::Ptr  createScript (const HelixParser & data);
     Patch::Ptr   createPatch (const HelixParser & data);
     Pattern::Ptr createPattern (const HelixParser & data);
@@ -89,4 +91,4 @@ class HelixSourceImpl : public zypp::source::SourceImpl {
 
 } // namespace zypp
 
-#endif // ZYPP_SOLVER_TEMPORARY_HELIXSOURCEIMPL_H
+#endif // ZYPP_SOLVER_HELIXSOURCEIMPL_H
index 440c667..0452ebd 100644 (file)
@@ -17,6 +17,7 @@ noinst_HEADERS = \
        HelixParser.h                           \
        HelixSourceImpl.h                       \
        HelixPackageImpl.h                      \
+       HelixLanguageImpl.h                     \
        HelixScriptImpl.h                       \
        HelixMessageImpl.h                      \
        HelixPatchImpl.h                        \
@@ -32,6 +33,7 @@ lib@PACKAGE@_helix_la_SOURCES =                       \
        HelixExtract.cc                         \
        HelixParser.cc                          \
        HelixSourceImpl.cc                      \
+       HelixLanguageImpl.cc                    \
        HelixPackageImpl.cc                     \
        HelixScriptImpl.cc                      \
        HelixMessageImpl.cc                     \