]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/types.h
Various fixes of issues reported by static analyzers.
[stg.git] / projects / stargazer / plugins / other / smux / types.h
index 26d6e24fbc6c665ebf194f25b0891105b8f3a508..2b54f2a2fc428231ef78266849433848abaf2940 100644 (file)
@@ -3,32 +3,55 @@
 
 #include <string>
 #include <vector>
-#include <istream>
+#include <iostream>
 
-#include "asn1/OBJECT_IDENTIFIER.h"
+#include "stg/OBJECT_IDENTIFIER.h"
 
 class OID {
     public:
-        OID(const std::string & str);
+        explicit OID(const std::string & str);
         OID(const char * str, size_t length);
-        OID(const std::vector<unsigned> & arcs);
+        explicit OID(const std::vector<unsigned> & arcs);
         OID(const unsigned * arcs, size_t length);
-        OID(OBJECT_IDENTIFIER_t * oid);
+        explicit OID(OBJECT_IDENTIFIER_t * oid);
         OID(const OID & rvalue);
         ~OID();
 
+        bool addSuffix(const char * suffix, size_t length);
+        bool addSuffix(const std::string & suffix);
+        bool addSuffix(const unsigned * suffix, size_t length);
+        bool addSuffix(const std::vector<unsigned> & suffix);
+        bool addSuffix(unsigned a, unsigned b);
+
+        OID copyWithSuffix(const char * suffix, size_t length) const;
+        OID copyWithSuffix(const std::string & suffix) const;
+        OID copyWithSuffix(const unsigned * suffix, size_t length) const;
+        OID copyWithSuffix(const std::vector<unsigned> & suffix) const;
+        OID copyWithSuffix(unsigned a, unsigned b) const;
+
         std::string ToString() const;
         const std::vector<unsigned> & ToVector() const { return arcs; }
         void ToOID(OBJECT_IDENTIFIER_t * oid) const;
 
         OID & operator=(const OID & rvalue);
         bool operator==(const OID & rvalue) const;
+        bool operator!=(const OID & rvalue) const { return !operator==(rvalue); }
         bool operator<(const OID & rvalue) const;
+        bool operator>(const OID & rvalue) const
+        { return !operator==(rvalue) && !operator<(rvalue); }
 
-        std::ostream & operator<<(std::ostream & stream) const;
+        bool PrefixLess(const OID & rvalue) const;
+
+        friend std::ostream & operator<<(std::ostream & stream, const OID & oid);
 
     private:
         std::vector<unsigned> arcs;
 };
 
+inline
+bool PrefixLess(const OID & a, const OID & b)
+{
+return a.PrefixLess(b);
+}
+
 #endif