This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup 01/11] Remove pointless abstract base class IniDBBuilder
- From: Jon Turney <jon dot turney at dronecode dot org dot uk>
- To: cygwin-apps at cygwin dot com
- Cc: Jon Turney <jon dot turney at dronecode dot org dot uk>
- Date: Fri, 28 Apr 2017 13:11:55 +0100
- Subject: [PATCH setup 01/11] Remove pointless abstract base class IniDBBuilder
- Authentication-results: sourceware.org; auth=none
- References: <20170428121205.12240-1-jon.turney@dronecode.org.uk>
There can be no instances of IniDBBuilder (it has pure virtual methods).
There is only one derived class IniDBBuilderPackage.
We can't think of any use for other derived classes.
---
IniDBBuilder.h | 59 ------------------------------------------------
IniDBBuilderPackage.h | 62 ++++++++++++++++++++++++++++++---------------------
ScanFindVisitor.cc | 4 ++--
ScanFindVisitor.h | 6 ++---
ini.h | 4 ++--
inilex.ll | 4 ++--
iniparse.yy | 4 ++--
7 files changed, 47 insertions(+), 96 deletions(-)
delete mode 100644 IniDBBuilder.h
diff --git a/IniDBBuilder.h b/IniDBBuilder.h
deleted file mode 100644
index b3f5c57..0000000
--- a/IniDBBuilder.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2002, Robert Collins.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * A copy of the GNU General Public License can be found at
- * http://www.gnu.org/
- *
- * Written by Robert Collins <rbtcollins@hotmail.com>
- *
- */
-
-#ifndef SETUP_INIDBBUILDER_H
-#define SETUP_INIDBBUILDER_H
-
-#include "PackageSpecification.h"
-
-class IniDBBuilder
-{
-public:
- virtual ~IniDBBuilder() {};
- virtual void buildTimestamp (const std::string& ) = 0;
- virtual void buildVersion (const std::string& ) = 0;
- virtual void buildPackage (const std::string& ) = 0;
- virtual void buildPackageVersion (const std::string& ) = 0;
- virtual void buildPackageSDesc (const std::string& ) = 0;
- virtual void buildPackageLDesc (const std::string& ) = 0;
- virtual void buildPackageInstall (const std::string& ) = 0;
- virtual void buildPackageSource (const std::string&, const std::string&) = 0;
- virtual void buildPackageTrust (int) = 0;
- virtual void buildPackageCategory (const std::string& ) = 0;
- virtual void buildBeginDepends () = 0;
- virtual void buildInstallSize (const std::string& ) = 0;
- virtual void buildInstallSHA512 (unsigned char const[64]) = 0;
- virtual void buildSourceSHA512 (unsigned char const[64]) = 0;
- virtual void buildInstallMD5 (unsigned char const[16]) = 0;
- virtual void buildSourceMD5 (unsigned char const[16]) = 0;
- virtual void buildBeginBuildDepends () = 0;
- virtual void buildSourceName (const std::string& ) = 0;
- virtual void buildSourceNameVersion (const std::string& ) = 0;
- virtual void buildPackageListAndNode () = 0;
- virtual void buildPackageListOrNode (const std::string& ) = 0;
- virtual void buildPackageListOperator (PackageSpecification::_operators const &) = 0;
- virtual void buildPackageListOperatorVersion (const std::string& ) = 0;
- virtual void buildMessage (const std::string&, const std::string&) = 0;
- void set_arch (const std::string& a) { arch = a; }
- void set_release (const std::string& rel) { release = rel; }
-
- unsigned int timestamp;
- std::string arch;
- std::string release;
- std::string version;
- std::string parse_mirror;
-};
-
-#endif /* SETUP_INIDBBUILDER_H */
diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h
index a97c53f..a39a95f 100644
--- a/IniDBBuilderPackage.h
+++ b/IniDBBuilderPackage.h
@@ -16,48 +16,58 @@
#ifndef SETUP_INIDBBUILDERPACKAGE_H
#define SETUP_INIDBBUILDERPACKAGE_H
-#include "IniDBBuilder.h"
#include <vector>
#include "package_version.h"
class IniParseFeedback;
class packagesource;
class packagemeta;
-class IniDBBuilderPackage:public IniDBBuilder
+class IniDBBuilderPackage
{
public:
IniDBBuilderPackage (IniParseFeedback const &);
~IniDBBuilderPackage ();
- virtual void buildTimestamp (const std::string& );
- virtual void buildVersion (const std::string& );
- virtual void buildPackage (const std::string& );
- virtual void buildPackageVersion (const std::string& );
- virtual void buildPackageSDesc (const std::string& );
- virtual void buildPackageLDesc (const std::string& );
- virtual void buildPackageInstall (const std::string& );
- virtual void buildPackageSource (const std::string&, const std::string&);
- virtual void buildPackageTrust (int);
- virtual void buildPackageCategory (const std::string& );
- virtual void buildBeginDepends ();
- virtual void buildInstallSize (const std::string& );
- virtual void buildInstallSHA512 (unsigned char const[64]);
- virtual void buildSourceSHA512 (unsigned char const[64]);
- virtual void buildInstallMD5 (unsigned char const[16]);
- virtual void buildSourceMD5 (unsigned char const[16]);
- virtual void buildBeginBuildDepends ();
- virtual void buildMessage (const std::string&, const std::string&);
- virtual void buildSourceName (const std::string& );
- virtual void buildSourceNameVersion (const std::string& );
- virtual void buildPackageListAndNode ();
- virtual void buildPackageListOrNode (const std::string& );
- virtual void buildPackageListOperator (PackageSpecification::_operators const &);
- virtual void buildPackageListOperatorVersion (const std::string& );
+ void buildTimestamp (const std::string& );
+ void buildVersion (const std::string& );
+ void buildPackage (const std::string& );
+ void buildPackageVersion (const std::string& );
+ void buildPackageSDesc (const std::string& );
+ void buildPackageLDesc (const std::string& );
+ void buildPackageInstall (const std::string& );
+ void buildPackageSource (const std::string&, const std::string&);
+ void buildPackageTrust (int);
+ void buildPackageCategory (const std::string& );
+
+ void buildBeginDepends ();
+ void buildInstallSize (const std::string& );
+ void buildInstallSHA512 (unsigned char const[64]);
+ void buildSourceSHA512 (unsigned char const[64]);
+ void buildInstallMD5 (unsigned char const[16]);
+ void buildSourceMD5 (unsigned char const[16]);
+ void buildBeginBuildDepends ();
+ void buildMessage (const std::string&, const std::string&);
+ void buildSourceName (const std::string& );
+ void buildSourceNameVersion (const std::string& );
+ void buildPackageListAndNode ();
+ void buildPackageListOrNode (const std::string& );
+ void buildPackageListOperator (PackageSpecification::_operators const &);
+ void buildPackageListOperatorVersion (const std::string& );
+
+ void set_arch (const std::string& a) { arch = a; }
+ void set_release (const std::string& rel) { release = rel; }
+
+ unsigned int timestamp;
+ std::string arch;
+ std::string release;
+ std::string version;
+ std::string parse_mirror;
private:
void add_correct_version();
void process_src (packagesource &src, const std::string& );
void setSourceSize (packagesource &src, const std::string& );
+
packagemeta *cp;
packageversion cbpv;
packagemeta *csp;
diff --git a/ScanFindVisitor.cc b/ScanFindVisitor.cc
index 50e7415..02cd6e8 100644
--- a/ScanFindVisitor.cc
+++ b/ScanFindVisitor.cc
@@ -15,9 +15,9 @@
#include "ScanFindVisitor.h"
#include "filemanip.h"
-#include "IniDBBuilder.h"
+#include "IniDBBuilderPackage.h"
-ScanFindVisitor::ScanFindVisitor(IniDBBuilder &aBuilder) : _Builder (aBuilder) {}
+ScanFindVisitor::ScanFindVisitor(IniDBBuilderPackage &aBuilder) : _Builder (aBuilder) {}
ScanFindVisitor::~ScanFindVisitor(){}
/* look for potential packages we can add to the in-memory package
diff --git a/ScanFindVisitor.h b/ScanFindVisitor.h
index 5755ca4..b4c93d9 100644
--- a/ScanFindVisitor.h
+++ b/ScanFindVisitor.h
@@ -18,19 +18,19 @@
#include "FindVisitor.h"
-class IniDBBuilder;
+class IniDBBuilderPackage ;
/* Scan files and create a package db when no cached .ini exists */
class ScanFindVisitor : public FindVisitor
{
public:
- ScanFindVisitor (IniDBBuilder &aBuilder);
+ ScanFindVisitor (IniDBBuilderPackage &aBuilder);
virtual void visitFile(const std::string& basePath, const WIN32_FIND_DATA *);
virtual ~ ScanFindVisitor ();
protected:
ScanFindVisitor (ScanFindVisitor const &);
ScanFindVisitor & operator= (ScanFindVisitor const &);
private:
- IniDBBuilder &_Builder;
+ IniDBBuilderPackage &_Builder;
};
#endif /* SETUP_SCANFINDVISITOR_H */
diff --git a/ini.h b/ini.h
index 3072637..4b9ed69 100644
--- a/ini.h
+++ b/ini.h
@@ -30,9 +30,9 @@ extern std::string SetupIniDir;
extern std::string SetupBaseName;
class IniState;
-class IniDBBuilder;
+class IniDBBuilderPackage;
class IniParseFeedback;
-void ini_init (io_stream *, IniDBBuilder *, IniParseFeedback &);
+void ini_init (io_stream *, IniDBBuilderPackage *, IniParseFeedback &);
#define YYSTYPE char *
/* When setup.ini is parsed, the information is stored according to
diff --git a/inilex.ll b/inilex.ll
index a6ae1fb..798a04b 100644
--- a/inilex.ll
+++ b/inilex.ll
@@ -160,13 +160,13 @@ B64 [a-zA-Z0-9_-]
#include "io_stream.h"
static io_stream *input_stream = 0;
-extern IniDBBuilder *iniBuilder;
+extern IniDBBuilderPackage *iniBuilder;
static IniParseFeedback *iniFeedback;
std::string current_ini_name, yyerror_messages;
int yyerror_count;
void
-ini_init(io_stream *stream, IniDBBuilder *aBuilder, IniParseFeedback &aFeedback)
+ini_init(io_stream *stream, IniDBBuilderPackage *aBuilder, IniParseFeedback &aFeedback)
{
input_stream = stream;
iniBuilder = aBuilder;
diff --git a/iniparse.yy b/iniparse.yy
index 6213b70..9ef4801 100644
--- a/iniparse.yy
+++ b/iniparse.yy
@@ -25,13 +25,13 @@
extern int yyerror (const std::string& s);
int yylex ();
-#include "IniDBBuilder.h"
+#include "IniDBBuilderPackage.h"
#define YYERROR_VERBOSE 1
#define YYINITDEPTH 1000
/*#define YYDEBUG 1*/
-IniDBBuilder *iniBuilder;
+IniDBBuilderPackage *iniBuilder;
extern int yylineno;
%}
--
2.12.2