const char *AbstractMacroReplacer::replace(const char *source){ if (isempty(source)) return NULL; StringEscaper *se = new StringEscaper(source); StringBuffer *pole = new StringBuffer(); sb->clear(); boolean b = false; while (!se->eof()){ char x = se->getChar(); if (!b){ if ((!se->getStatus() ) && (x == bdelim)) b = true; else sb->add(x); }else{ if ((!se->getStatus() ) && (x == edelim)){ sb->add( replaceField( pole->get() ) ); b = false; pole->clear(); } else pole->add(x); } } delete(pole); delete(se); return sb->get(); };
void TextFile::iterate(){ if (len <= 0) return; StringBuffer *sb = new StringBuffer(); boolean b = false; for (size_t i = 0; i <= len; i++) if ((data[i] != '\n') && (data[i] != '\r')){ sb->add(data[i]); b = true; }else{ if (!iterator(sb->get())) break; b = false; sb->clear(); } if (b) //resolving <EOF> at the end iterator(sb->get() ); delete(sb); };
void Log(log_level level, const char* owner, StringBuffer const& buffer) { for (size_t i = 0; i < theLogger.size(); ++i) { theLogger[i]->log(level, owner, buffer.get().c_str(), WHITE); } }