public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 01/11] Remove pointless abstract base class IniDBBuilder
Date: Fri, 28 Apr 2017 12:12:00 -0000	[thread overview]
Message-ID: <20170428121205.12240-2-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <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

  reply	other threads:[~2017-04-28 12:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-28 12:12 [PATCH setup 00/11] Various setup patches Jon Turney
2017-04-28 12:12 ` Jon Turney [this message]
2017-04-28 12:12 ` [PATCH setup 02/11] Remove unused package_status_t stored in packageversion class Jon Turney
2017-04-28 12:13 ` [PATCH setup 08/11] Don't do unneeded work when changing stability level Jon Turney
2017-04-28 12:13 ` [PATCH setup 04/11] Make packageversion::source(|s) const Jon Turney
2017-04-28 12:13 ` [PATCH setup 09/11] Make building with DEBUG less useless Jon Turney
2017-04-28 12:13 ` [PATCH setup 03/11] Remove cygpackage::destroy() because it does nothing Jon Turney
2017-04-28 12:13 ` [PATCH setup 07/11] Don't handle missing 'version:' Jon Turney
2017-04-28 12:13 ` [PATCH setup 10/11] Don't show source-only packages in package list Jon Turney
2017-05-01 14:45   ` Yaakov Selkowitz
2017-05-01 19:35     ` Jon Turney
2017-04-28 12:13 ` [PATCH setup 11/11] Use wininet for fetching URLs in direct (non-proxy) case (DO NOT APPLY) Jon Turney
2017-04-28 15:33   ` Åke Rehnman
2017-04-29 10:53     ` Jon Turney
2017-05-01 12:58       ` Jon Turney
2017-05-01 15:31         ` Åke Rehnman
2017-05-01 20:45           ` Jon Turney
2017-05-02  7:28             ` Åke Rehnman
2017-05-02 11:05               ` Jon Turney
2017-05-02 19:29                 ` Åke Rehnman
2017-05-03 16:37                   ` Jon Turney
     [not found]                     ` <60ed2d4e-7c89-a9b8-e3ab-e3d0819b7e56@gmail.com>
2017-05-04 10:11                       ` Jon Turney
2017-05-16 14:00                         ` Jon Turney
     [not found]                           ` <e402101c-8e7d-98ed-b39a-c82100d6d59f@gmail.com>
2017-05-17 10:55                             ` Jon Turney
2017-05-03  7:22                 ` Brian Inglis
2017-05-03 16:37                   ` Jon Turney
2017-04-28 12:13 ` [PATCH setup 06/11] packageversion::sourcePackageSpecification() is const Jon Turney
2017-04-28 12:13 ` [PATCH setup 05/11] Use const version of packageversion::depends() in PrereqChecker Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170428121205.12240-2-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).