/************************************************************************* * * HTCd - Copyright (C) 1998-2006 Henrik Rydberg * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include using namespace std; int int_stream::appc(char c) { return val=c,1; } int int_stream::appi(int i) { return val=i,1; } int int_stream::appf(double f) { return val=(int)f,1; } int int_stream::apps(const sref& s) { return val=atoi(s),s.size(); } /////////////////////////////////////////////////// record_t::record_t(const spile& list) { pos[0].set(0); for(int i=0;i p=equal_range(begin(),end(),idx_t(t,0),comp); return p.first!=p.second?p.first-begin():-1; } int indexmap::add(const sref& t,record_t* rec) { idx_t tmp(t,rec); pair p=equal_range(begin(),end(),tmp,comp); if(p.first!=p.second) return &(*p.first=tmp)-begin(); else return insert(p.second,tmp)-begin(); } void indexmap::sort(const op_t* op) { comp.func=op->f2; ::sort(begin(),end(),comp); }