]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/types.h
Fight CLang warnings.
[stg.git] / projects / stargazer / plugins / other / smux / types.h
index 974d56bf351b09bd888236f916c3217bfe7a400c..f6b145f7e001094ca0a4d67b572a7a4ea68c9fdf 100644 (file)
@@ -1,22 +1,37 @@
-#ifndef __TYPES_H__
-#define __TYPES_H__
+#pragma once
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+#include "stg/OBJECT_IDENTIFIER.h"
+#pragma GCC diagnostic pop
 
 #include <string>
 #include <vector>
-#include <istream>
-
-#include "stg/OBJECT_IDENTIFIER.h"
+#include <iostream>
 
-class OID {
+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;
@@ -28,10 +43,16 @@ class OID {
         bool operator>(const OID & rvalue) const
         { return !operator==(rvalue) && !operator<(rvalue); }
 
+        bool PrefixLess(const OID & rvalue) const;
+
         friend std::ostream & operator<<(std::ostream & stream, const OID & oid);
 
     private:
         std::vector<unsigned> arcs;
 };
 
-#endif
+inline
+bool PrefixLess(const OID & a, const OID & b)
+{
+return a.PrefixLess(b);
+}