]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Add parser/libsquid-parser.la
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 10 Dec 2013 15:02:19 +0000 (07:02 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 10 Dec 2013 15:02:19 +0000 (07:02 -0800)
Also, basic class CharacterSet definition

configure.ac
src/Makefile.am
src/parser/CharacterSet.h [new file with mode: 0644]
src/parser/Makefile.am [new file with mode: 0644]

index d238d694bcf99065278a9146f5528051a258d51d..2e956d232af76e2007f6ae22625450c953bcb3a4 100644 (file)
@@ -3425,6 +3425,7 @@ AC_CONFIG_FILES([\
        src/ipc/Makefile \
        src/ssl/Makefile \
        src/mgr/Makefile \
+       src/parser/Makefile \
        src/snmp/Makefile \
        contrib/Makefile \
        snmplib/Makefile \
index 12f19f1352ea4879578cabbf3e4585ce5041569b..fee975dd546b81c9105b006dead722eb3ff60ac2 100644 (file)
@@ -30,8 +30,8 @@ LOADABLE_MODULES_SOURCES = \
        LoadableModules.h \
        LoadableModules.cc
 
-SUBDIRS        = base anyp comm eui acl format fs repl
-DIST_SUBDIRS = base anyp comm eui acl format fs repl
+SUBDIRS        = base anyp parser comm eui acl format fs repl
+DIST_SUBDIRS = base anyp parser comm eui acl format fs repl
 
 if ENABLE_AUTH
 SUBDIRS += auth
@@ -636,6 +636,7 @@ squid_LDADD = \
        $(ESI_LIBS) \
        $(SSL_LIBS) \
        $(SNMP_LIBS) \
+       parser/libsquid-parser.la \
        $(top_builddir)/lib/libmisccontainers.la \
        $(top_builddir)/lib/libmiscencoding.la \
        $(top_builddir)/lib/libmiscutil.la \
diff --git a/src/parser/CharacterSet.h b/src/parser/CharacterSet.h
new file mode 100644 (file)
index 0000000..0b0207e
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef _SQUID_SRC_PARSER_CHARACTERSET_H
+#define _SQUID_SRC_PARSER_CHARACTERSET_H
+
+#include <map>
+
+namespace Parser {
+
+class CharacterSet
+{
+public:
+    CharacterSet(const char *label, const char * const c) : name_(label) {
+        memset(match_, 0, sizeof(match_));
+        const size_t = strlen(c);
+        for (size_t i = 0; i < len; ++i) {
+            match_[static_cast<uint8_t>(c)] = true;
+        }
+    }
+
+    /// whether a given character exists in the set
+    bool operator[](char t) const {return match_[static_cast<uint8_t>(c)];}
+
+    void add(const char c) {match_[static_cast<uint8_t>(c)] = true;}
+
+    /// add all characters from the given CharacterSet to this one
+    const CharacterSet &operator +=(const CharacterSet &src) {
+        for (size_t i = 0; i < 256; ++i) {
+            if(src.match_[i])
+                match_[i] = true;
+        }
+        return *this;
+    }
+
+private:
+  char * name_;
+  std::map<bool> chars_;
+};
+
+} // namespace Parser
+
+#endif /* _SQUID_SRC_PARSER_CHARACTERSET_H */
diff --git a/src/parser/Makefile.am b/src/parser/Makefile.am
new file mode 100644 (file)
index 0000000..e877f0b
--- /dev/null
@@ -0,0 +1,6 @@
+include $(top_srcdir)/src/Common.am
+
+noinst_LTLIBRARIES = libsquid-parser.la
+
+libsquid_parser_la_SOURCES = \
+       CharacterSet.h