📄 support.cxx
字号:
// $Id: support.cxx,v 1.2 1999/08/31 02:25:26 cullen Exp $/*This library is free software; you can redistribute it and/or modifyit under the terms of the GNU Lesser General Public License aspublished by the Free Software Foundation; either version 2 of theLicense, or (at your option) any later version.This library is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNULesser General Public License for more details.You should have received a copy of the GNU Lesser General PublicLicense along with this library; if not; write to the Free SoftwareFoundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA.*/// $Log: support.cxx,v $// Revision 1.2 1999/08/31 02:25:26 cullen// updated indentation//// Revision 1.1 1999/08/31 01:53:27 cullen// Cullen check in some code from Luan that has things needed to compile//// Revision 1.7 1999/06/30 06:09:08 bogawa//// update copyright and license//// Revision 1.6 1999/06/29 23:42:03 bogawa//// Updated copyright notice.//// Revision 1.5 1999/06/28 21:30:37 bogawa//// Update to the latest version of the MGCP stack.//// Revision 1.4 1999/06/09 08:16:44 bogawa//// Add copyright notices.//// Revision 1.3 1999/06/09 01:04:59 bogawa//// Changes to make the new structure compile correctly, and to allow the// code to use the new hardware structure. gateway1 is now using the// new structure fully, while gateway2 is using it partially (actually// not very much).//// A future version should be much cleaner.//#include "support.hxx"/**********************************************************************Support functions for the MGCP library.**********************************************************************/vector<string>& split(const string& inputText, const string& characters){ vector<string>* splitted; string::size_type position = 0, oldPosition = 0; splitted = new vector<string>; while(position < inputText.length()) { position = inputText.find_first_of(characters, oldPosition); if(position == string::npos) position = inputText.length();// cout << inputText.substr(oldPosition, (position - oldPosition));// cout << ":\n"; (*splitted).push_back( inputText.substr(oldPosition, (position - oldPosition))); oldPosition = position + 1; } return *splitted;}void chop(string* input){ string::iterator p = input->end(); if(p != input->begin()) --p; input->erase(p);}void chomp(string* input){ size_t i; i = input->length() - 1; if(i >=0) { if( ((*input)[i] == '\n' ) || ((*input)[i] == '\r')) { input->erase(i, 1); } }}string itos(int i){ char buf[32]; int index = 0; string s; while(i) { buf[index] = i % 10 + '0'; index++; } for(int j = 0; j < index; j++) { s[j] = buf[index-j]; } return s;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -