---------------------------------------------------------------------------
| 132 | } |
| 133 | //--------------------------------------------------------------------------- |
| 134 | void TSyslogMessage::FromString(char * p, int len) |
| 135 | { |
| 136 | // SourceAddr = String(p, int count) 5 time faster than |
| 137 | // String SourceAddr += *p |
| 138 | |
| 139 | if( ! p ) |
| 140 | return; |
| 141 | if( ! *p ) |
| 142 | return; |
| 143 | |
| 144 | int i=0, c; |
| 145 | |
| 146 | for(c=0; p[i]!='\t' && i<len; i++,c++); |
| 147 | SourceAddr = String(p+i-c, c); |
| 148 | if( p[i]=='\t' ) i++; // skip tab char |
| 149 | |
| 150 | for(c=0; p[i]!='\t' && i<len; i++,c++); |
| 151 | DateStr = String(p+i-c, c); |
| 152 | if( p[i]=='\t' ) i++; |
| 153 | |
| 154 | for(c=0; p[i]!='\t' && i<len; i++,c++); |
| 155 | HostName = String(p+i-c, c); |
| 156 | if( p[i]=='\t' ) i++; |
| 157 | |
| 158 | for(c=0; p[i]!='\t' && i<len; i++,c++); |
| 159 | Facility = String(p+i-c, c); |
| 160 | if( p[i]=='\t' ) i++; |
| 161 | |
| 162 | for(c=0; p[i]!='\t' && i<len; i++,c++); |
| 163 | Priority = String(p+i-c, c); |
| 164 | if( p[i]=='\t' ) i++; |
| 165 | |
| 166 | for(c=0; p[i]!='\t' && i<len; i++,c++); |
| 167 | Tag = String(p+i-c, c); |
| 168 | if( p[i]=='\t' ) i++; |
| 169 | |
| 170 | for(c=0; p[i]!='\t' && i<len; i++,c++); |
| 171 | Msg = String(p+i-c, c); |
| 172 | |
| 173 | // -1 if gettextcode nothing found |
| 174 | PRI = gettextcode(Priority.c_str(), prioritynames); |
| 175 | if( PRI >= 0 ) |
| 176 | { |
| 177 | int i = gettextcode(Facility.c_str(), facilitynames); |
| 178 | if( i >= 0 ) |
| 179 | PRI |= i; |
| 180 | } |
| 181 | } |
| 182 | //--------------------------------------------------------------------------- |
| 183 | /* |
| 184 | bool TSyslogMessage::SaveToFile(const String & file) |