diff --git a/src/bindings/go/openalprgo.cpp b/src/bindings/go/openalprgo.cpp index 8516155..ef07201 100644 --- a/src/bindings/go/openalprgo.cpp +++ b/src/bindings/go/openalprgo.cpp @@ -1,6 +1,6 @@ -#include -#include +#include #include +#include #include #include "openalprgo.h" diff --git a/src/bindings/python/openalprpy.cpp b/src/bindings/python/openalprpy.cpp index 9076146..255992f 100644 --- a/src/bindings/python/openalprpy.cpp +++ b/src/bindings/python/openalprpy.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include diff --git a/src/daemon/beanstalk.c b/src/daemon/beanstalk.c index e1252d2..f7811a6 100644 --- a/src/daemon/beanstalk.c +++ b/src/daemon/beanstalk.c @@ -1,4 +1,7 @@ #include "beanstalk.h" +#include +#include +#include #include #include #include diff --git a/src/daemon/beanstalk.cc b/src/daemon/beanstalk.cc index cc8ee32..0d79622 100644 --- a/src/daemon/beanstalk.cc +++ b/src/daemon/beanstalk.cc @@ -1,7 +1,8 @@ #include "beanstalk.hpp" -#include #include -#include +#include +#include +#include using namespace std; diff --git a/src/daemon/beanstalk.h b/src/daemon/beanstalk.h index be245a1..f639b3a 100644 --- a/src/daemon/beanstalk.h +++ b/src/daemon/beanstalk.h @@ -1,8 +1,6 @@ #pragma once -#include -#include -#include +#include #include #include #include diff --git a/src/misc_utilities/benchmarks/benchmark_utils.h b/src/misc_utilities/benchmarks/benchmark_utils.h index 499f712..36d12c1 100644 --- a/src/misc_utilities/benchmarks/benchmark_utils.h +++ b/src/misc_utilities/benchmarks/benchmark_utils.h @@ -1,7 +1,8 @@ #ifndef OPENALPR_BENCHMARKUTILS_H #define OPENALPR_BENCHMARKUTILS_H -#include +#include +#include std::vector filterByExtension(std::vector fileList, std::string extension); diff --git a/src/misc_utilities/benchmarks/endtoendtest.cpp b/src/misc_utilities/benchmarks/endtoendtest.cpp index 205f8f0..606b78e 100644 --- a/src/misc_utilities/benchmarks/endtoendtest.cpp +++ b/src/misc_utilities/benchmarks/endtoendtest.cpp @@ -1,5 +1,8 @@ #include "endtoendtest.h" +#include +#include + using namespace std; using namespace cv; using namespace alpr; diff --git a/src/misc_utilities/benchmarks/endtoendtest.h b/src/misc_utilities/benchmarks/endtoendtest.h index 4f7d936..fec64e5 100644 --- a/src/misc_utilities/benchmarks/endtoendtest.h +++ b/src/misc_utilities/benchmarks/endtoendtest.h @@ -1,6 +1,9 @@ #ifndef OPENALPR_ENDTOENDTEST_H #define OPENALPR_ENDTOENDTEST_H +#include +#include + #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" diff --git a/src/misc_utilities/binarizefontsheet.cpp b/src/misc_utilities/binarizefontsheet.cpp index d095b40..045ad64 100644 --- a/src/misc_utilities/binarizefontsheet.cpp +++ b/src/misc_utilities/binarizefontsheet.cpp @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include #include "../tclap/CmdLine.h" #include "utility.h" #include "support/utf8.h" diff --git a/src/openalpr/alpr.cpp b/src/openalpr/alpr.cpp index 5ab89ea..1bbdfb6 100644 --- a/src/openalpr/alpr.cpp +++ b/src/openalpr/alpr.cpp @@ -20,6 +20,8 @@ #include "alpr.h" #include "alpr_impl.h" +#include + namespace alpr { diff --git a/src/openalpr/alpr.h b/src/openalpr/alpr.h index b08913a..0db4c06 100644 --- a/src/openalpr/alpr.h +++ b/src/openalpr/alpr.h @@ -20,10 +20,9 @@ #ifndef OPENALPR_ALPR_H #define OPENALPR_ALPR_H -#include -#include -#include +#include #include +#include #ifdef WIN32 #define OPENALPR_DLL_EXPORT __declspec( dllexport ) diff --git a/src/openalpr/binarize_wolf.h b/src/openalpr/binarize_wolf.h index ca2e5be..cf59394 100644 --- a/src/openalpr/binarize_wolf.h +++ b/src/openalpr/binarize_wolf.h @@ -22,8 +22,6 @@ #include "support/filesystem.h" -#include -#include #include "opencv2/opencv.hpp" namespace alpr diff --git a/src/openalpr/config.h b/src/openalpr/config.h index 53748b2..29973b8 100644 --- a/src/openalpr/config.h +++ b/src/openalpr/config.h @@ -24,11 +24,8 @@ #include "constants.h" -#include -#include +#include #include -#include /* getenv */ -#include namespace alpr { diff --git a/src/openalpr/detection/detector.h b/src/openalpr/detection/detector.h index b2be755..57c6af5 100644 --- a/src/openalpr/detection/detector.h +++ b/src/openalpr/detection/detector.h @@ -20,8 +20,8 @@ #ifndef OPENALPR_REGIONDETECTOR_H #define OPENALPR_REGIONDETECTOR_H -#include -#include +#include +#include #include "utility.h" diff --git a/src/openalpr/detection/detectorcpu.cpp b/src/openalpr/detection/detectorcpu.cpp index d34b333..8c2f385 100644 --- a/src/openalpr/detection/detectorcpu.cpp +++ b/src/openalpr/detection/detectorcpu.cpp @@ -19,6 +19,8 @@ #include "detectorcpu.h" +#include + using namespace cv; using namespace std; diff --git a/src/openalpr/detection/detectorcpu.h b/src/openalpr/detection/detectorcpu.h index 9e776bd..300c457 100644 --- a/src/openalpr/detection/detectorcpu.h +++ b/src/openalpr/detection/detectorcpu.h @@ -20,8 +20,6 @@ #ifndef OPENALPR_DETECTORCPU_H #define OPENALPR_DETECTORCPU_H -#include -#include #include #include "opencv2/objdetect/objdetect.hpp" diff --git a/src/openalpr/detection/detectorcuda.h b/src/openalpr/detection/detectorcuda.h index c093626..18111b3 100644 --- a/src/openalpr/detection/detectorcuda.h +++ b/src/openalpr/detection/detectorcuda.h @@ -21,8 +21,6 @@ #define OPENALPR_DETECTORCUDA_H -#include -#include #include #ifdef COMPILE_GPU diff --git a/src/openalpr/detection/detectormask.h b/src/openalpr/detection/detectormask.h index f1296cf..ac825c3 100644 --- a/src/openalpr/detection/detectormask.h +++ b/src/openalpr/detection/detectormask.h @@ -20,7 +20,7 @@ #ifndef OPENALPR_DETECTORMASK_H #define OPENALPR_DETECTORMASK_H -#include +#include #include "opencv2/imgproc/imgproc.hpp" #include "config.h" #include "prewarp.h" diff --git a/src/openalpr/detection/detectormorph.h b/src/openalpr/detection/detectormorph.h index 5d4040b..29d65ab 100644 --- a/src/openalpr/detection/detectormorph.h +++ b/src/openalpr/detection/detectormorph.h @@ -20,8 +20,6 @@ #ifndef OPENALPR_DETECTORMORPH_H #define OPENALPR_DETECTORMORPH_H -#include -#include #include #include "opencv2/objdetect/objdetect.hpp" diff --git a/src/openalpr/detection/detectorocl.h b/src/openalpr/detection/detectorocl.h index 5e9109d..e68f1ed 100644 --- a/src/openalpr/detection/detectorocl.h +++ b/src/openalpr/detection/detectorocl.h @@ -20,8 +20,6 @@ #ifndef OPENALPR_DETECTOROPENCL_H #define OPENALPR_DETECTOROPENCL_H -#include -#include #include #if OPENCV_MAJOR_VERSION == 3 diff --git a/src/openalpr/edges/scorekeeper.cpp b/src/openalpr/edges/scorekeeper.cpp index 370c3b2..4438811 100644 --- a/src/openalpr/edges/scorekeeper.cpp +++ b/src/openalpr/edges/scorekeeper.cpp @@ -17,7 +17,8 @@ * along with this program. If not, see . */ -#include +#include +#include #include "scorekeeper.h" diff --git a/src/openalpr/edges/scorekeeper.h b/src/openalpr/edges/scorekeeper.h index b6a0301..e395801 100644 --- a/src/openalpr/edges/scorekeeper.h +++ b/src/openalpr/edges/scorekeeper.h @@ -21,8 +21,7 @@ #define OPENALPR_SCOREKEEPER_H #include -#include -#include +#include namespace alpr { diff --git a/src/openalpr/licenseplatecandidate.h b/src/openalpr/licenseplatecandidate.h index 2a48193..b1a38c5 100644 --- a/src/openalpr/licenseplatecandidate.h +++ b/src/openalpr/licenseplatecandidate.h @@ -20,8 +20,6 @@ #ifndef OPENALPR_LICENSEPLATECANDIDATE_H #define OPENALPR_LICENSEPLATECANDIDATE_H -#include -#include #include #include "opencv2/imgproc/imgproc.hpp" diff --git a/src/openalpr/ocr/segmentation/segment.h b/src/openalpr/ocr/segmentation/segment.h index 596e3c8..5e6ca23 100644 --- a/src/openalpr/ocr/segmentation/segment.h +++ b/src/openalpr/ocr/segmentation/segment.h @@ -20,9 +20,6 @@ #ifndef OPENALPR_SEGMENT_H #define OPENALPR_SEGMENT_H -#include -#include - #include "opencv2/imgproc/imgproc.hpp" namespace alpr diff --git a/src/openalpr/ocr/segmentation/segmentationgroup.h b/src/openalpr/ocr/segmentation/segmentationgroup.h index c0d3398..ff21193 100644 --- a/src/openalpr/ocr/segmentation/segmentationgroup.h +++ b/src/openalpr/ocr/segmentation/segmentationgroup.h @@ -21,7 +21,6 @@ #define OPENALPR_SEGMENTATIONGROUP_H #include -#include #include "opencv2/imgproc/imgproc.hpp" diff --git a/src/openalpr/ocr/tesseract_ocr.h b/src/openalpr/ocr/tesseract_ocr.h index f3f1974..0b794a2 100644 --- a/src/openalpr/ocr/tesseract_ocr.h +++ b/src/openalpr/ocr/tesseract_ocr.h @@ -20,8 +20,7 @@ #ifndef OPENALPR_TESSERACTOCR_H #define OPENALPR_TESSERACTOCR_H -#include -#include +#include #include "utility.h" #include "config.h" diff --git a/src/openalpr/postprocess/postprocess.cpp b/src/openalpr/postprocess/postprocess.cpp index a842f41..9a8f5a6 100644 --- a/src/openalpr/postprocess/postprocess.cpp +++ b/src/openalpr/postprocess/postprocess.cpp @@ -19,6 +19,10 @@ #include "postprocess.h" +#include +#include +#include + using namespace std; namespace alpr diff --git a/src/openalpr/postprocess/postprocess.h b/src/openalpr/postprocess/postprocess.h index 27c83ae..bd8855f 100644 --- a/src/openalpr/postprocess/postprocess.h +++ b/src/openalpr/postprocess/postprocess.h @@ -23,12 +23,9 @@ #include "regexrule.h" #include "constants.h" #include "utility.h" -#include -#include -#include -#include -#include #include +#include +#include #include "config.h" diff --git a/src/openalpr/postprocess/regexrule.cpp b/src/openalpr/postprocess/regexrule.cpp index 8eda3b4..dcfb540 100644 --- a/src/openalpr/postprocess/regexrule.cpp +++ b/src/openalpr/postprocess/regexrule.cpp @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include "regexrule.h" diff --git a/src/openalpr/postprocess/regexrule.h b/src/openalpr/postprocess/regexrule.h index 2f485d4..7a72de8 100644 --- a/src/openalpr/postprocess/regexrule.h +++ b/src/openalpr/postprocess/regexrule.h @@ -20,10 +20,8 @@ #ifndef OPENALPR_REGEXRULE_H #define OPENALPR_REGEXRULE_H -#include #include -#include -#include + #include "support/re2.h" #include "support/utf8.h" #include "support/tinythread.h" diff --git a/src/openalpr/result_aggregator.cpp b/src/openalpr/result_aggregator.cpp index 80d5e56..6680196 100644 --- a/src/openalpr/result_aggregator.cpp +++ b/src/openalpr/result_aggregator.cpp @@ -19,6 +19,8 @@ #include "result_aggregator.h" +#include + using namespace std; using namespace cv; diff --git a/src/openalpr/support/filesystem.cpp b/src/openalpr/support/filesystem.cpp index a71fe92..f9de674 100644 --- a/src/openalpr/support/filesystem.cpp +++ b/src/openalpr/support/filesystem.cpp @@ -1,6 +1,11 @@ #include "filesystem.h" -#include + #include +#include +#include +#include + + namespace alpr { diff --git a/src/openalpr/support/filesystem.h b/src/openalpr/support/filesystem.h index 8278bde..c8de9e1 100644 --- a/src/openalpr/support/filesystem.h +++ b/src/openalpr/support/filesystem.h @@ -13,14 +13,10 @@ typedef int mode_t; #include #endif -#include +#include +#include #include -#include -#include -#include -#include #include -#include namespace alpr { diff --git a/src/openalpr/support/re2/dfa.cc b/src/openalpr/support/re2/dfa.cc index e595a78..04945bd 100644 --- a/src/openalpr/support/re2/dfa.cc +++ b/src/openalpr/support/re2/dfa.cc @@ -27,6 +27,29 @@ #include "util/flags.h" #include "util/sparse_set.h" +#include +#include +#include + +#if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(_LIBCPP_ABI_VERSION) + +#include +using std::tr1::unordered_set; + +#else + +#include +#if defined(_WIN32) +using std::tr1::unordered_set; +#else +using std::unordered_set; +#endif + +#endif + +using std::swap; +using std::vector; + DEFINE_bool(re2_dfa_bail_when_slow, true, "Whether the RE2 DFA should bail out early " "if the NFA would be faster (for testing)."); @@ -168,6 +191,7 @@ class DFA { #endif // STL_MSVC }; + #ifdef STL_MSVC typedef unordered_set StateSet; #else // !STL_MSVC @@ -711,7 +735,7 @@ DFA::State* DFA::WorkqToCachedState(Workq* q, uint flag) { int* markp = ip; while (markp < ep && *markp != Mark) markp++; - sort(ip, markp); + std::sort(ip, markp); if (markp < ep) markp++; ip = markp; diff --git a/src/openalpr/support/re2/nfa.cc b/src/openalpr/support/re2/nfa.cc index 57a18fe..5e82842 100644 --- a/src/openalpr/support/re2/nfa.cc +++ b/src/openalpr/support/re2/nfa.cc @@ -29,6 +29,8 @@ #include "util/sparse_array.h" #include "util/sparse_set.h" +using std::swap; + namespace re2 { class NFA { diff --git a/src/openalpr/support/re2/onepass.cc b/src/openalpr/support/re2/onepass.cc index 2404617..0c34ea7 100644 --- a/src/openalpr/support/re2/onepass.cc +++ b/src/openalpr/support/re2/onepass.cc @@ -476,8 +476,8 @@ bool Prog::IsOnePass() { } } if (ip->foldcase()) { - Rune lo = max(ip->lo(), 'a') + 'A' - 'a'; - Rune hi = min(ip->hi(), 'z') + 'A' - 'a'; + Rune lo = std::max(ip->lo(), 'a') + 'A' - 'a'; + Rune hi = std::min(ip->hi(), 'z') + 'A' - 'a'; for (int c = lo; c <= hi; c++) { int b = bytemap_[c]; c = unbytemap_[b]; // last c in class diff --git a/src/openalpr/support/re2/parse.cc b/src/openalpr/support/re2/parse.cc index e6b27d2..18dbb0e 100644 --- a/src/openalpr/support/re2/parse.cc +++ b/src/openalpr/support/re2/parse.cc @@ -24,6 +24,8 @@ #include "re2/walker-inl.h" namespace re2 { + + using std::string; // Regular expression parse state. // The list of parsed regexps so far is maintained as a vector of @@ -340,7 +342,7 @@ static void AddFoldedRange(CharClassBuilder* cc, Rune lo, Rune hi, int depth) { // Add in the result of folding the range lo - f->hi // and that range's fold, recursively. Rune lo1 = lo; - Rune hi1 = min(hi, f->hi); + Rune hi1 = std::min(hi, f->hi); switch (f->delta) { default: lo1 += f->delta; diff --git a/src/openalpr/support/re2/prefilter.cc b/src/openalpr/support/re2/prefilter.cc index 153318f..23c5ce6 100644 --- a/src/openalpr/support/re2/prefilter.cc +++ b/src/openalpr/support/re2/prefilter.cc @@ -8,6 +8,9 @@ #include "re2/unicode_casefold.h" #include "re2/walker-inl.h" +using std::set; +using std::vector; + namespace re2 { static const int Trace = false; diff --git a/src/openalpr/support/re2/prefilter.h b/src/openalpr/support/re2/prefilter.h index 2bc1676..75137be 100644 --- a/src/openalpr/support/re2/prefilter.h +++ b/src/openalpr/support/re2/prefilter.h @@ -9,6 +9,9 @@ #ifndef RE2_PREFILTER_H_ #define RE2_PREFILTER_H_ +#include +#include + #include "util/util.h" namespace re2 { @@ -32,19 +35,19 @@ class Prefilter { ~Prefilter(); Op op() { return op_; } - const string& atom() const { return atom_; } + const std::string& atom() const { return atom_; } void set_unique_id(int id) { unique_id_ = id; } int unique_id() const { return unique_id_; } // The children of the Prefilter node. - vector* subs() { + std::vector* subs() { CHECK(op_ == AND || op_ == OR); return subs_; } // Set the children vector. Prefilter takes ownership of subs and // subs_ will be deleted when Prefilter is deleted. - void set_subs(vector* subs) { subs_ = subs; } + void set_subs(std::vector* subs) { subs_ = subs; } // Given a RE2, return a Prefilter. The caller takes ownership of // the Prefilter and should deallocate it. Returns NULL if Prefilter @@ -52,7 +55,7 @@ class Prefilter { static Prefilter* FromRE2(const RE2* re2); // Returns a readable debug string of the prefilter. - string DebugString() const; + std::string DebugString() const; private: class Info; @@ -70,9 +73,9 @@ class Prefilter { static Prefilter* FromRegexp(Regexp* a); - static Prefilter* FromString(const string& str); + static Prefilter* FromString(const std::string& str); - static Prefilter* OrStrings(set* ss); + static Prefilter* OrStrings(std::set* ss); static Info* BuildInfo(Regexp* re); @@ -82,10 +85,10 @@ class Prefilter { Op op_; // Sub-matches for AND or OR Prefilter. - vector* subs_; + std::vector* subs_; // Actual string to match in leaf node. - string atom_; + std::string atom_; // If different prefilters have the same string atom, or if they are // structurally the same (e.g., OR of same atom strings) they are diff --git a/src/openalpr/support/re2/prefilter_tree.cc b/src/openalpr/support/re2/prefilter_tree.cc index 01e8cf9..c77dc6f 100644 --- a/src/openalpr/support/re2/prefilter_tree.cc +++ b/src/openalpr/support/re2/prefilter_tree.cc @@ -8,6 +8,10 @@ #include "re2/prefilter_tree.h" #include "re2.h" +using std::set; +using std::string; +using std::vector; + DEFINE_int32(filtered_re2_min_atom_len, 3, "Strings less than this length are not stored as atoms"); diff --git a/src/openalpr/support/re2/prefilter_tree.h b/src/openalpr/support/re2/prefilter_tree.h index abea55d..c619664 100644 --- a/src/openalpr/support/re2/prefilter_tree.h +++ b/src/openalpr/support/re2/prefilter_tree.h @@ -16,13 +16,16 @@ #ifndef RE2_PREFILTER_TREE_H_ #define RE2_PREFILTER_TREE_H_ +#include +#include + #include "util/util.h" #include "util/sparse_array.h" namespace re2 { typedef SparseArray IntMap; -typedef map StdIntMap; +typedef std::map StdIntMap; class Prefilter; @@ -42,15 +45,15 @@ class PrefilterTree { // The caller should use the returned set of strings to do string matching. // Each time a string matches, the corresponding index then has to be // and passed to RegexpsGivenStrings below. - void Compile(vector* atom_vec); + void Compile(std::vector* atom_vec); // Given the indices of the atoms that matched, returns the indexes // of regexps that should be searched. The matched_atoms should // contain all the ids of string atoms that were found to match the // content. The caller can use any string match engine to perform // this function. This function is thread safe. - void RegexpsGivenStrings(const vector& matched_atoms, - vector* regexps) const; + void RegexpsGivenStrings(const std::vector& matched_atoms, + std::vector* regexps) const; // Print debug prefilter. Also prints unique ids associated with // nodes of the prefilter of the regexp. @@ -76,17 +79,17 @@ class PrefilterTree { // When this node is ready to trigger the parent, what are the // regexps that are triggered. - vector regexps; + std::vector regexps; }; private: // This function assigns unique ids to various parts of the // prefilter, by looking at if these nodes are already in the // PrefilterTree. - void AssignUniqueIds(vector* atom_vec); + void AssignUniqueIds(std::vector* atom_vec); // Given the matching atoms, find the regexps to be triggered. - void PropagateMatch(const vector& atom_ids, + void PropagateMatch(const std::vector& atom_ids, IntMap* regexps) const; // Returns the prefilter node that has the same NodeString as this @@ -95,30 +98,30 @@ class PrefilterTree { // A string that uniquely identifies the node. Assumes that the // children of node has already been assigned unique ids. - string NodeString(Prefilter* node) const; + std::string NodeString(Prefilter* node) const; // Recursively constructs a readable prefilter string. - string DebugNodeString(Prefilter* node) const; + std::string DebugNodeString(Prefilter* node) const; // Used for debugging. void PrintDebugInfo(); // These are all the nodes formed by Compile. Essentially, there is // one node for each unique atom and each unique AND/OR node. - vector entries_; + std::vector entries_; // Map node string to canonical Prefilter node. - map node_map_; + std::map node_map_; // indices of regexps that always pass through the filter (since we // found no required literals in these regexps). - vector unfiltered_; + std::vector unfiltered_; // vector of Prefilter for all regexps. - vector prefilter_vec_; + std::vector prefilter_vec_; // Atom index in returned strings to entry id mapping. - vector atom_index_to_id_; + std::vector atom_index_to_id_; // Has the prefilter tree been compiled. bool compiled_; diff --git a/src/openalpr/support/re2/prog.h b/src/openalpr/support/re2/prog.h index c67b83c..3f290bc 100644 --- a/src/openalpr/support/re2/prog.h +++ b/src/openalpr/support/re2/prog.h @@ -13,6 +13,8 @@ #include "re2/util/sparse_array.h" #include "re2.h" +#include + namespace re2 { // Simple fixed-size bitmap. @@ -273,7 +275,7 @@ class Prog { bool SearchDFA(const StringPiece& text, const StringPiece& context, Anchor anchor, MatchKind kind, StringPiece* match0, bool* failed, - vector* matches); + std::vector* matches); // Build the entire DFA for the given match kind. FOR TESTING ONLY. // Usually the DFA is built out incrementally, as needed, which diff --git a/src/openalpr/support/re2/re2.cc b/src/openalpr/support/re2/re2.cc index 3f0020f..8ffc4e8 100644 --- a/src/openalpr/support/re2/re2.cc +++ b/src/openalpr/support/re2/re2.cc @@ -9,7 +9,6 @@ #include "re2.h" -#include #include #ifndef WIN32 #include diff --git a/src/openalpr/support/re2/regexp.cc b/src/openalpr/support/re2/regexp.cc index 3667fda..e83d979 100644 --- a/src/openalpr/support/re2/regexp.cc +++ b/src/openalpr/support/re2/regexp.cc @@ -5,11 +5,17 @@ // Regular expression representation. // Tested by parse_test.cc +#include + #include "util/util.h" #include "re2/regexp.h" #include "re2/stringpiece.h" #include "re2/walker-inl.h" +using std::map; +using std::string; +using std::vector; + namespace re2 { // Constructor. Allocates vectors as appropriate for operator. @@ -712,13 +718,13 @@ bool CharClassBuilder::AddRange(Rune lo, Rune hi) { if (lo <= 'z' && hi >= 'A') { // Overlaps some alpha, maybe not all. // Update bitmaps telling which ASCII letters are in the set. - Rune lo1 = max(lo, 'A'); - Rune hi1 = min(hi, 'Z'); + Rune lo1 = std::max(lo, 'A'); + Rune hi1 = std::min(hi, 'Z'); if (lo1 <= hi1) upper_ |= ((1 << (hi1 - lo1 + 1)) - 1) << (lo1 - 'A'); - lo1 = max(lo, 'a'); - hi1 = min(hi, 'z'); + lo1 = std::max(lo, 'a'); + hi1 = std::min(hi, 'z'); if (lo1 <= hi1) lower_ |= ((1 << (hi1 - lo1 + 1)) - 1) << (lo1 - 'a'); } diff --git a/src/openalpr/support/re2/regexp.h b/src/openalpr/support/re2/regexp.h index 60eb993..27eac4c 100644 --- a/src/openalpr/support/re2/regexp.h +++ b/src/openalpr/support/re2/regexp.h @@ -86,6 +86,9 @@ #ifndef RE2_REGEXP_H__ #define RE2_REGEXP_H__ +#include +#include + #include "util/util.h" #include "re2/stringpiece.h" @@ -187,7 +190,7 @@ class RegexpStatus { void set_code(enum RegexpStatusCode code) { code_ = code; } void set_error_arg(const StringPiece& error_arg) { error_arg_ = error_arg; } - void set_tmp(string* tmp) { delete tmp_; tmp_ = tmp; } + void set_tmp(std::string* tmp) { delete tmp_; tmp_ = tmp; } enum RegexpStatusCode code() const { return code_; } const StringPiece& error_arg() const { return error_arg_; } bool ok() const { return code() == kRegexpSuccess; } @@ -197,16 +200,16 @@ class RegexpStatus { // Returns text equivalent of code, e.g.: // "Bad character class" - static string CodeText(enum RegexpStatusCode code); + static std::string CodeText(enum RegexpStatusCode code); // Returns text describing error, e.g.: // "Bad character class: [z-a]" - string Text() const; + std::string Text() const; private: enum RegexpStatusCode code_; // Kind of error StringPiece error_arg_; // Piece of regexp containing syntax error. - string* tmp_; // Temporary storage, possibly where error_arg_ is. + std::string* tmp_; // Temporary storage, possibly where error_arg_ is. DISALLOW_COPY_AND_ASSIGN(RegexpStatus); }; @@ -328,7 +331,7 @@ class Regexp { Rune rune() { DCHECK_EQ(op_, kRegexpLiteral); return rune_; } CharClass* cc() { DCHECK_EQ(op_, kRegexpCharClass); return cc_; } int cap() { DCHECK_EQ(op_, kRegexpCapture); return cap_; } - const string* name() { DCHECK_EQ(op_, kRegexpCapture); return name_; } + const std::string* name() { DCHECK_EQ(op_, kRegexpCapture); return name_; } Rune* runes() { DCHECK_EQ(op_, kRegexpLiteralString); return runes_; } int nrunes() { DCHECK_EQ(op_, kRegexpLiteralString); return nrunes_; } int match_id() { DCHECK_EQ(op_, kRegexpHaveMatch); return match_id_; } @@ -359,7 +362,7 @@ class Regexp { // string representation of the simplified form. Returns true on success. // Returns false and sets *status (if status != NULL) on parse error. static bool SimplifyRegexp(const StringPiece& src, ParseFlags flags, - string* dst, + std::string* dst, RegexpStatus* status); // Returns the number of capturing groups in the regexp. @@ -369,16 +372,16 @@ class Regexp { // Returns a map from names to capturing group indices, // or NULL if the regexp contains no named capture groups. // The caller is responsible for deleting the map. - map* NamedCaptures(); + std::map* NamedCaptures(); // Returns a map from capturing group indices to capturing group // names or NULL if the regexp contains no named capture groups. The // caller is responsible for deleting the map. - map* CaptureNames(); + std::map* CaptureNames(); // Returns a string representation of the current regexp, // using as few parentheses as possible. - string ToString(); + std::string ToString(); // Convenience functions. They consume the passed reference, // so in many cases you should use, e.g., Plus(re->Incref(), flags). @@ -400,7 +403,7 @@ class Regexp { // Debugging function. Returns string format for regexp // that makes structure clear. Does NOT use regexp syntax. - string Dump(); + std::string Dump(); // Helper traversal class, defined fully in walker-inl.h. template class Walker; @@ -427,7 +430,7 @@ class Regexp { // begin with a non-empty fixed string (perhaps after ASCII // case-folding). If so, returns the prefix and the sub-regexp that // follows it. - bool RequiredPrefix(string* prefix, bool *foldcase, Regexp** suffix); + bool RequiredPrefix(std::string* prefix, bool *foldcase, Regexp** suffix); private: // Constructor allocates vectors as appropriate for operator. @@ -550,7 +553,7 @@ class Regexp { }; struct { // Capture int cap_; - string* name_; + std::string* name_; }; struct { // LiteralString int nrunes_; @@ -572,7 +575,7 @@ class Regexp { }; // Character class set: contains non-overlapping, non-abutting RuneRanges. -typedef set RuneRangeSet; +typedef std::set RuneRangeSet; class CharClassBuilder { public: diff --git a/src/openalpr/support/re2/simplify.cc b/src/openalpr/support/re2/simplify.cc index 9c0021e..cb48322 100644 --- a/src/openalpr/support/re2/simplify.cc +++ b/src/openalpr/support/re2/simplify.cc @@ -11,6 +11,8 @@ #include "re2/walker-inl.h" namespace re2 { + + using std::string; // Parses the regexp src and then simplifies it and sets *dst to the // string representation of the simplified form. Returns true on success. diff --git a/src/openalpr/support/re2/stringpiece.cc b/src/openalpr/support/re2/stringpiece.cc index f9e2294..359b46d 100644 --- a/src/openalpr/support/re2/stringpiece.cc +++ b/src/openalpr/support/re2/stringpiece.cc @@ -2,9 +2,12 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +#include + #include "re2/stringpiece.h" #include "util/util.h" +using std::string; using re2::StringPiece; std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { @@ -34,7 +37,7 @@ void StringPiece::CopyToString(string* target) const { } int StringPiece::copy(char* buf, size_type n, size_type pos) const { - int ret = min(length_ - pos, n); + int ret = std::min(length_ - pos, n); memcpy(buf, ptr_ + pos, ret); return ret; } @@ -64,16 +67,16 @@ int StringPiece::find(char c, size_type pos) const { int StringPiece::rfind(const StringPiece& s, size_type pos) const { if (length_ < s.length_) return npos; const size_t ulen = length_; - if (s.length_ == 0) return min(ulen, pos); + if (s.length_ == 0) return std::min(ulen, pos); - const char* last = ptr_ + min(ulen - s.length_, pos) + s.length_; + const char* last = ptr_ + std::min(ulen - s.length_, pos) + s.length_; const char* result = std::find_end(ptr_, last, s.ptr_, s.ptr_ + s.length_); return result != last ? result - ptr_ : npos; } int StringPiece::rfind(char c, size_type pos) const { if (length_ <= 0) return npos; - for (int i = min(pos, static_cast(length_ - 1)); + for (int i = std::min(pos, static_cast(length_ - 1)); i >= 0; --i) { if (ptr_[i] == c) { return i; diff --git a/src/openalpr/support/re2/tostring.cc b/src/openalpr/support/re2/tostring.cc index 56ca7df..2147e69 100644 --- a/src/openalpr/support/re2/tostring.cc +++ b/src/openalpr/support/re2/tostring.cc @@ -9,6 +9,8 @@ #include "re2/regexp.h" #include "re2/walker-inl.h" +using std::string; + namespace re2 { enum { diff --git a/src/openalpr/support/re2/util/logging.h b/src/openalpr/support/re2/util/logging.h index 5eaf1dc..c6052b6 100644 --- a/src/openalpr/support/re2/util/logging.h +++ b/src/openalpr/support/re2/util/logging.h @@ -7,7 +7,11 @@ #ifndef RE2_UTIL_LOGGING_H__ #define RE2_UTIL_LOGGING_H__ +#include +#include #include /* for fwrite */ +#include +#include #include // Debug-only checking. @@ -53,7 +57,7 @@ class LogMessage { } void Flush() { stream() << "\n"; - string s = str_.str(); + std::string s = str_.str(); size_t n = s.size(); if (fwrite(s.data(), 1, n, stderr) < n) {} // shut up gcc flushed_ = true; @@ -63,7 +67,7 @@ class LogMessage { Flush(); } } - ostream& stream() { return str_; } + std::ostream& stream() { return str_; } private: bool flushed_; diff --git a/src/openalpr/support/re2/util/sparse_array.h b/src/openalpr/support/re2/util/sparse_array.h index e552f8f..7b2983e 100644 --- a/src/openalpr/support/re2/util/sparse_array.h +++ b/src/openalpr/support/re2/util/sparse_array.h @@ -94,6 +94,10 @@ #include "re2/util/util.h" +#include +#include +#include + namespace re2 { template @@ -107,8 +111,8 @@ class SparseArray { class IndexValue; typedef IndexValue value_type; - typedef typename vector::iterator iterator; - typedef typename vector::const_iterator const_iterator; + typedef typename std::vector::iterator iterator; + typedef typename std::vector::const_iterator const_iterator; inline const IndexValue& iv(int i) const; @@ -160,7 +164,7 @@ class SparseArray { // Set the value at index i to v. inline iterator set(int i, Value v); - pair insert(const value_type& new_value); + std::pair insert(const value_type& new_value); // Returns the value at index i // or defaultv if index i is not initialized in the array. @@ -223,7 +227,7 @@ class SparseArray { int size_; int max_size_; int* sparse_to_dense_; - vector dense_; + std::vector dense_; bool valgrind_; DISALLOW_COPY_AND_ASSIGN(SparseArray); @@ -318,14 +322,14 @@ typename SparseArray::iterator SparseArray::set(int i, Value v) { } template -pair::iterator, bool> SparseArray::insert( +std::pair::iterator, bool> SparseArray::insert( const value_type& new_value) { DebugCheckInvariants(); - pair::iterator, bool> p; + std::pair::iterator, bool> p; if (has_index(new_value.index_)) { - p = make_pair(dense_.begin() + sparse_to_dense_[new_value.index_], false); + p = std::make_pair(dense_.begin() + sparse_to_dense_[new_value.index_], false); } else { - p = make_pair(set_new(new_value.index_, new_value.second), true); + p = std::make_pair(set_new(new_value.index_, new_value.second), true); } DebugCheckInvariants(); return p; diff --git a/src/openalpr/support/re2/util/sparse_set.h b/src/openalpr/support/re2/util/sparse_set.h index 1612632..96fdc55 100644 --- a/src/openalpr/support/re2/util/sparse_set.h +++ b/src/openalpr/support/re2/util/sparse_set.h @@ -49,6 +49,8 @@ #include "re2/util/util.h" +#include + namespace re2 { static bool InitMemory() { diff --git a/src/openalpr/support/re2/util/stringprintf.cc b/src/openalpr/support/re2/util/stringprintf.cc index 5f1869f..4fdf4c2 100644 --- a/src/openalpr/support/re2/util/stringprintf.cc +++ b/src/openalpr/support/re2/util/stringprintf.cc @@ -4,6 +4,10 @@ #include "re2/util/util.h" +#include + +using std::string; + namespace re2 { static void StringAppendV(string* dst, const char* format, va_list ap) { diff --git a/src/openalpr/support/re2/util/strutil.cc b/src/openalpr/support/re2/util/strutil.cc index a09701e..226ce1c 100644 --- a/src/openalpr/support/re2/util/strutil.cc +++ b/src/openalpr/support/re2/util/strutil.cc @@ -6,6 +6,8 @@ #include "re2/stringpiece.h" namespace re2 { + + using std::string; // ---------------------------------------------------------------------- // CEscapeString() diff --git a/src/openalpr/support/re2/util/utf.h b/src/openalpr/support/re2/util/utf.h index 06ff8f0..6ebfa2d 100644 --- a/src/openalpr/support/re2/util/utf.h +++ b/src/openalpr/support/re2/util/utf.h @@ -17,7 +17,6 @@ #ifndef RE2_UTIL_UTF_H__ #define RE2_UTIL_UTF_H__ -#include namespace re2 { diff --git a/src/openalpr/support/re2/util/util.h b/src/openalpr/support/re2/util/util.h index 974223e..bbb84c9 100644 --- a/src/openalpr/support/re2/util/util.h +++ b/src/openalpr/support/re2/util/util.h @@ -6,60 +6,15 @@ #define RE2_UTIL_UTIL_H__ // C -#include -#include #include #include // For size_t -#include -#include -#include // For clock_gettime, CLOCK_REALTIME -#include // For isdigit, isalpha #if !defined(_WIN32) #include // For gettimeofday #endif // C++ -#include -#include #include -#include -#include -#include -#include -#include -#include -#include - -// Use std names. -using std::set; -using std::pair; -using std::vector; -using std::string; -using std::min; -using std::max; -using std::ostream; -using std::map; -using std::stack; -using std::sort; -using std::swap; -using std::make_pair; - -#if defined(__GNUC__) && !defined(USE_CXX0X) && !defined(_LIBCPP_ABI_VERSION) - -#include -using std::tr1::unordered_set; - -#else - -#include -#if defined(_WIN32) -using std::tr1::unordered_set; -#else -using std::unordered_set; -#endif - -#endif #ifdef _WIN32 @@ -120,13 +75,13 @@ template struct CompileAssert {}; class StringPiece; -string CEscape(const StringPiece& src); +std::string CEscape(const StringPiece& src); int CEscapeString(const char* src, int src_len, char* dest, int dest_len); -extern string StringPrintf(const char* format, ...); -extern void SStringPrintf(string* dst, const char* format, ...); -extern void StringAppendF(string* dst, const char* format, ...); -extern string PrefixSuccessor(const StringPiece& prefix); +extern std::string StringPrintf(const char* format, ...); +extern void SStringPrintf(std::string* dst, const char* format, ...); +extern void StringAppendF(std::string* dst, const char* format, ...); +extern std::string PrefixSuccessor(const StringPiece& prefix); uint32 hashword(const uint32*, size_t, uint32); void hashword2(const uint32*, size_t, uint32*, uint32*); diff --git a/src/openalpr/support/re2/walker-inl.h b/src/openalpr/support/re2/walker-inl.h index bdcf7f5..f99499e 100644 --- a/src/openalpr/support/re2/walker-inl.h +++ b/src/openalpr/support/re2/walker-inl.h @@ -13,6 +13,8 @@ #ifndef RE2_WALKER_INL_H__ #define RE2_WALKER_INL_H__ +#include + #include "re2/regexp.h" namespace re2 { @@ -86,7 +88,7 @@ template class Regexp::Walker { private: // Walk state for the entire traversal. - stack >* stack_; + std::stack >* stack_; bool stopped_early_; int max_visits_; @@ -130,7 +132,7 @@ template struct WalkState { }; template Regexp::Walker::Walker() { - stack_ = new stack >; + stack_ = new std::stack >; stopped_early_ = false; } diff --git a/src/openalpr/support/version.cpp b/src/openalpr/support/version.cpp index b82a557..973fd73 100644 --- a/src/openalpr/support/version.cpp +++ b/src/openalpr/support/version.cpp @@ -1,9 +1,7 @@ #include "version.h" - #include -#include -#include + int cmpVersion(const char *v1, const char *v2) { int i; diff --git a/src/openalpr/support/version.h b/src/openalpr/support/version.h index 94b56dd..937c635 100644 --- a/src/openalpr/support/version.h +++ b/src/openalpr/support/version.h @@ -1,9 +1,6 @@ #ifndef OPENALPR_VERSION_H #define OPENALPR_VERSION_H -#include -#include - /* * return 1 if v1 > v2 * return 0 if v1 = v2 diff --git a/src/openalpr/utility.h b/src/openalpr/utility.h index 000752e..3a494ba 100644 --- a/src/openalpr/utility.h +++ b/src/openalpr/utility.h @@ -20,9 +20,8 @@ #ifndef OPENALPR_UTILITY_H #define OPENALPR_UTILITY_H -#include -#include -#include +#include +#include #include "constants.h" #include "support/timing.h" @@ -30,7 +29,6 @@ #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/core/core.hpp" #include "binarize_wolf.h" -#include #include "config.h" namespace alpr diff --git a/src/tclap/Arg.h b/src/tclap/Arg.h index ab051d3..023b2df 100644 --- a/src/tclap/Arg.h +++ b/src/tclap/Arg.h @@ -34,9 +34,6 @@ #include #include #include -#include -#include -#include #if defined(HAVE_SSTREAM) #include diff --git a/src/tclap/CmdLine.h b/src/tclap/CmdLine.h index 4d3a18a..dcb73ae 100644 --- a/src/tclap/CmdLine.h +++ b/src/tclap/CmdLine.h @@ -43,8 +43,6 @@ #include #include #include -#include -#include #include #include // Needed for exit(), which isn't defined in some envs. diff --git a/src/tclap/CmdLineInterface.h b/src/tclap/CmdLineInterface.h index 8838b46..0698271 100644 --- a/src/tclap/CmdLineInterface.h +++ b/src/tclap/CmdLineInterface.h @@ -26,7 +26,6 @@ #include #include #include -#include #include diff --git a/src/tclap/CmdLineOutput.h b/src/tclap/CmdLineOutput.h index 539d3f3..f94aca5 100644 --- a/src/tclap/CmdLineOutput.h +++ b/src/tclap/CmdLineOutput.h @@ -26,8 +26,6 @@ #include #include #include -#include -#include #include namespace TCLAP diff --git a/src/tclap/Constraint.h b/src/tclap/Constraint.h index 7930010..5c2d5e0 100644 --- a/src/tclap/Constraint.h +++ b/src/tclap/Constraint.h @@ -25,8 +25,6 @@ #include #include #include -#include -#include #include namespace TCLAP diff --git a/src/tclap/XorHandler.h b/src/tclap/XorHandler.h index 9498bc5..d7aa1df 100644 --- a/src/tclap/XorHandler.h +++ b/src/tclap/XorHandler.h @@ -27,7 +27,6 @@ #include #include #include -#include namespace TCLAP { diff --git a/src/video/videobuffer.h b/src/video/videobuffer.h index 4954f52..d3bc2f1 100644 --- a/src/video/videobuffer.h +++ b/src/video/videobuffer.h @@ -2,8 +2,10 @@ #define OPENALPR_VIDEOBUFFER_H #include +#include #include #include +#include #include "opencv2/highgui/highgui.hpp"