Set inline functions in header files (ticket #115)
authorBalazs Dezso <deba@inf.elte.hu>
Tue, 08 Jul 2008 14:57:44 +0200
changeset 1975893bacaa720
parent 193 65cba1032f90
child 198 e80e08222fdf
Set inline functions in header files (ticket #115)
lemon/lgf_reader.h
lemon/lgf_writer.h
     1.1 --- a/lemon/lgf_reader.h	Sun Jul 06 07:49:03 2008 +0100
     1.2 +++ b/lemon/lgf_reader.h	Tue Jul 08 14:57:44 2008 +0200
     1.3 @@ -195,44 +195,44 @@
     1.4        }
     1.5      };
     1.6  
     1.7 -    bool isWhiteSpace(char c) {
     1.8 +    inline bool isWhiteSpace(char c) {
     1.9        return c == ' ' || c == '\t' || c == '\v' || 
    1.10          c == '\n' || c == '\r' || c == '\f'; 
    1.11      }
    1.12      
    1.13 -    bool isOct(char c) {
    1.14 +    inline bool isOct(char c) {
    1.15        return '0' <= c && c <='7'; 
    1.16      }
    1.17      
    1.18 -    int valueOct(char c) {
    1.19 +    inline int valueOct(char c) {
    1.20        LEMON_ASSERT(isOct(c), "The character is not octal.");
    1.21        return c - '0';
    1.22      }
    1.23  
    1.24 -    bool isHex(char c) {
    1.25 +    inline bool isHex(char c) {
    1.26        return ('0' <= c && c <= '9') || 
    1.27  	('a' <= c && c <= 'z') || 
    1.28  	('A' <= c && c <= 'Z'); 
    1.29      }
    1.30      
    1.31 -    int valueHex(char c) {
    1.32 +    inline int valueHex(char c) {
    1.33        LEMON_ASSERT(isHex(c), "The character is not hexadecimal.");
    1.34        if ('0' <= c && c <= '9') return c - '0';
    1.35        if ('a' <= c && c <= 'z') return c - 'a' + 10;
    1.36        return c - 'A' + 10;
    1.37      }
    1.38  
    1.39 -    bool isIdentifierFirstChar(char c) {
    1.40 +    inline bool isIdentifierFirstChar(char c) {
    1.41        return ('a' <= c && c <= 'z') ||
    1.42  	('A' <= c && c <= 'Z') || c == '_';
    1.43      }
    1.44  
    1.45 -    bool isIdentifierChar(char c) {
    1.46 +    inline bool isIdentifierChar(char c) {
    1.47        return isIdentifierFirstChar(c) ||
    1.48  	('0' <= c && c <= '9');
    1.49      }
    1.50  
    1.51 -    char readEscape(std::istream& is) {
    1.52 +    inline char readEscape(std::istream& is) {
    1.53        char c;
    1.54        if (!is.get(c))
    1.55  	throw DataFormatError("Escape format error");
    1.56 @@ -284,7 +284,7 @@
    1.57        } 
    1.58      }
    1.59      
    1.60 -    std::istream& readToken(std::istream& is, std::string& str) {
    1.61 +    inline std::istream& readToken(std::istream& is, std::string& str) {
    1.62        std::ostringstream os;
    1.63  
    1.64        char c;
     2.1 --- a/lemon/lgf_writer.h	Sun Jul 06 07:49:03 2008 +0100
     2.2 +++ b/lemon/lgf_writer.h	Tue Jul 08 14:57:44 2008 +0200
     2.3 @@ -225,17 +225,17 @@
     2.4        }
     2.5      };
     2.6  
     2.7 -    bool isWhiteSpace(char c) {
     2.8 +    inline bool isWhiteSpace(char c) {
     2.9        return c == ' ' || c == '\t' || c == '\v' || 
    2.10          c == '\n' || c == '\r' || c == '\f'; 
    2.11      }
    2.12  
    2.13 -    bool isEscaped(char c) {
    2.14 +    inline bool isEscaped(char c) {
    2.15        return c == '\\' || c == '\"' || c == '\'' || 
    2.16  	c == '\a' || c == '\b';
    2.17      }
    2.18  
    2.19 -    static void writeEscape(std::ostream& os, char c) {
    2.20 +    inline static void writeEscape(std::ostream& os, char c) {
    2.21        switch (c) {
    2.22        case '\\':
    2.23  	os << "\\\\";
    2.24 @@ -276,7 +276,7 @@
    2.25        }     
    2.26      }
    2.27  
    2.28 -    bool requireEscape(const std::string& str) {
    2.29 +    inline bool requireEscape(const std::string& str) {
    2.30        if (str.empty() || str[0] == '@') return true;
    2.31        std::istringstream is(str);
    2.32        char c;
    2.33 @@ -288,7 +288,7 @@
    2.34        return false;
    2.35      }
    2.36      
    2.37 -    std::ostream& writeToken(std::ostream& os, const std::string& str) {
    2.38 +    inline std::ostream& writeToken(std::ostream& os, const std::string& str) {
    2.39  
    2.40        if (requireEscape(str)) {
    2.41  	os << '\"';