]> git.tdb.fi Git - libs/core.git/commitdiff
Formatting fixes
authorMikko Rasa <tdb@tdb.fi>
Mon, 3 Jun 2019 11:36:37 +0000 (14:36 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 3 Jun 2019 11:37:44 +0000 (14:37 +0300)
examples/grep.cpp
jis.py
source/core/getopt.cpp
source/strings/lexicalcast.h

index 66d70f3a486fe6801b7b95ad970cf1a554a48726..ca23499a2165480d1f705d5a58a9a3f40aac914a 100644 (file)
@@ -17,12 +17,12 @@ int main(int argc, char **argv)
 
        Regex regex(re_str);
        if(debug)
-               cout<<regex.disassemble();
+               cout << regex.disassemble();
        string line;
        while(getline(cin, line))
        {
                if(RegMatch match = regex.match(line))
-                       cout<<line<<'\n';
+                       cout << line << '\n';
        }
 
        return 0;
diff --git a/jis.py b/jis.py
index 7fe20d08501ea08b9d577ce3bbbb26495a052a4a..aed6064a592b992d211530ef3eb4d131b34613ff 100755 (executable)
--- a/jis.py
+++ b/jis.py
@@ -3,25 +3,25 @@
 import sys
 import os
 
-in_fn=sys.argv[1]
-out_fn=os.path.splitext(in_fn)[0]+".table"
+in_fn = sys.argv[1]
+out_fn = os.path.splitext(in_fn)[0]+".table"
 
-data=[]
+data = []
 for line in file(in_fn):
-       line=line.strip()
+       line = line.strip()
        if line[0]=='#':
                continue
-       parts=line.split(None, 3)
-       code=eval(parts[1])-0x2020
-       code2=(code&0xFF)+((code>>8)&0xFF)*94-95
+       parts = line.split(None, 3)
+       code = eval(parts[1])-0x2020
+       code2 = (code&0xFF)+((code>>8)&0xFF)*94-95
        data.append((code, eval(parts[2]), code2))
 
-out=file(out_fn, "w")
+out = file(out_fn, "w")
 out.write("namespace {\n\n")
 
 data.sort(lambda x,y: cmp(x[0],y[0]))
 out.write("const unsigned short jisx0208_to_ucs_table[94*94] =\n{\n\t")
-i=0
+i = 0
 for code in xrange(94*94):
        if code>0:
                out.write(", ")
@@ -29,7 +29,7 @@ for code in xrange(94*94):
                        out.write("\n\t")
        if i<len(data) and data[i][2]==code:
                out.write("0x%04X"%data[i][1])
-               i+=1
+               i += 1
        else:
                out.write("0     ")
 out.write("\n};\n\n")
index 6d96f0b335a568801170f79394ed7886acae1d0b..9040f5d43ec684ecd83d11113931051b4ab13876 100644 (file)
@@ -105,7 +105,7 @@ void GetOpt::operator()(unsigned argc, const char *const *argv)
                        else
                                args_raw.push_back(argv[i++]);
                }
-               
+
                for(; i<argc; ++i)
                        args_raw.push_back(argv[i]);
 
@@ -153,9 +153,9 @@ unsigned GetOpt::process_long(const char *const *argp)
        // See if the argument contains an =
        unsigned equals = 0;
        for(; arg[equals] && arg[equals]!='='; ++equals) ;
-       
+
        OptionImpl &opt = get_option(string(arg, equals));
-       
+
        if(arg[equals])
                // Process the part after the = as option argument
                opt.process(arg+equals+1);
@@ -170,7 +170,7 @@ unsigned GetOpt::process_long(const char *const *argp)
        }
        else
                opt.process();
-       
+
        return 1;
 }
 
@@ -194,7 +194,7 @@ unsigned GetOpt::process_short(const char *const *argp)
                {
                        if(!argp[1])
                                throw usage_error("-"+string(1, *arg)+" requires an argument");
-                       
+
                        // Use the next argument as option argument
                        opt.process(argp[1]);
                        return 2;
@@ -310,7 +310,7 @@ string GetOpt::generate_help() const
                for(ArgumentList::const_iterator i=args.begin(); i!=args.end(); ++i, ++j)
                        result += format("  %s%s%s\n", *j, string(maxw+2-j->size(), ' '), (*i)->get_help());
        }
-       
+
        return result;
 }
 
index 13eab45f0b81c9311381f43f880caf2abb5fcf5b..6fe3cb366b24015ea215c127913db9f43ac42276 100644 (file)
@@ -118,7 +118,7 @@ typename EnableIf<HasFormattedOutput<T>::value, void>::Yes
 operator<<(LexicalConverter &c, const T &v)
 {
        std::ostringstream ss;
-       ss<<c.get_fmt()<<v;
+       ss << c.get_fmt() << v;
        c.result(ss.str());
 }
 
@@ -128,7 +128,7 @@ operator>>(const LexicalConverter &c, T &v)
 {
        std::istringstream ss(c.get());
        ss.setf(std::ios_base::fmtflags(0), std::ios_base::skipws);
-       ss>>v;
+       ss >> v;
        if(ss.fail() || !ss.eof())
                throw lexical_error("conversion failure");
 }
@@ -146,7 +146,7 @@ struct LexicalCast<T, std::string>
        {
                LexicalConverter conv(s, f);
                T result;
-               conv>>result;
+               conv >> result;
                return result;
        }
 };
@@ -157,7 +157,7 @@ struct LexicalCast<std::string, F>
        static std::string cast(const F &v, const Fmt &f = Fmt())
        {
                LexicalConverter conv(f);
-               conv<<v;
+               conv << v;
                return conv.get();
        }
 };
@@ -168,7 +168,7 @@ struct LexicalCast<std::string, std::string>
        static std::string cast(const std::string &v, const Fmt &f = Fmt())
        {
                LexicalConverter conv(f);
-               conv<<v;
+               conv << v;
                return conv.get();
        }
 };