]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/getopt.h
Style fix: split function bodies to separate line outside of class
[libs/core.git] / source / core / getopt.h
index bb1bd1568f6dff403843e6bd57492bc0832fb21d..ea1f7d36a33fcea90ba552e58cb8b7546e462f34 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspcore
-Copyright © 2006-2009, 2011 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_CORE_GETOPT_H_
 #define MSP_CORE_GETOPT_H_
 
@@ -72,6 +65,9 @@ private:
        template<typename T>
        class Option: public OptBase
        {
+       private:
+               T &data;
+
        public:
                Option(char s, const std::string &l, T &d, ArgType a): OptBase(s, l, a), data(d) { }
 
@@ -88,13 +84,14 @@ private:
                                throw usage_error("Invalid argument for --"+lng+" ("+e.what()+")");
                        }
                }
-       private:
-               T &data;
        };
 
        template<typename T>
        class ListOption: public OptBase
        {
+       private:
+               T &data;
+
        public:
                ListOption(char s, const std::string &l, T &d, ArgType a): OptBase(s, l, a), data(d)
                { if(arg_type!=REQUIRED_ARG) throw std::invalid_argument("ListOption arg_type!=REQUIRED"); }
@@ -112,8 +109,6 @@ private:
                                throw usage_error("Invalid argument for --"+lng+" ("+e.what()+")");
                        }
                }
-       private:
-               T &data;
        };
 
        bool help;
@@ -163,8 +158,11 @@ public:
        std::string generate_help() const;
 };
 
-template<> inline void GetOpt::Option<bool>::store()     { data = true; }
-template<> inline void GetOpt::Option<unsigned>::store() { ++data; }
+template<> inline void GetOpt::Option<bool>::store()
+{ data = true; }
+
+template<> inline void GetOpt::Option<unsigned>::store()
+{ ++data; }
 
 template<> inline void GetOpt::Option<std::string>::store(const std::string &a)
 { data = a; }