本文整理汇总了C++中Strings::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Strings::begin方法的具体用法?C++ Strings::begin怎么用?C++ Strings::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Strings
的用法示例。
在下文中一共展示了Strings::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strip
String String::strip(Strings tokens) const
{
if(tokens.empty())
tokens.push_back(L" ");
IndexVar left = 0, right = mContent.size();
while(left<mContent.size())
{
bool flag = false;
for(Strings::iterator ptr = tokens.begin(); ptr != tokens.end(); ptr++)
if(find(*ptr,left)==left)
{
flag = true;
break;
}
if(!flag)
break;
left++;
}
while(right>=0)
{
bool flag = false;
for(Strings::iterator ptr = tokens.begin(); ptr != tokens.end(); ptr++)
if(rfind(*ptr,right-1)==right-1)
{
flag = true;
break;
}
if(!flag)
break;
right--;
}
return substr(left,right-left);
}
示例2: lineSlice
std::string
StringTools::wrap( const std::string &text,
int wrapColumn )
{
const char lineBreak = '\n';
Strings lines = split( text, lineBreak );
std::string wrapped;
for ( Strings::const_iterator it = lines.begin(); it != lines.end(); ++it )
{
if ( it != lines.begin() )
wrapped += lineBreak;
const std::string &line = *it;
unsigned int index =0;
while ( index < line.length() )
{
std::string lineSlice( line.substr( index, wrapColumn ) );
wrapped += lineSlice;
index += wrapColumn;
if ( index < line.length() )
wrapped += lineBreak;
}
}
return wrapped;
}
示例3: split
Strings String::split(Strings tokens) const
{
if(tokens.empty())
tokens.push_back(L" ");
Strings ans;
base_wstring nowS;
IndexVar index = 0;
while(index<mContent.size())
{
bool flag = false;
for(Strings::iterator ptr = tokens.begin(); ptr != tokens.end(); ptr++)
if(find(*ptr,index)==index)
{
flag = true;
ans.push_back(nowS);
nowS = L"";
break;
}
if(!flag)
nowS += mContent[index];
index++;
}
ans.push_back(nowS);
return ans;
}
示例4: Compile
bool User_Program::Compile (string &text, bool list_flag)
{
Strings lines;
Str_Itr line_itr;
//---- split the text into lines ----
String_Ptr (text)->Parse (lines, "\n\r\f");
for (line_itr = lines.begin (); line_itr != lines.end (); line_itr++) {
line_num++;
if (list_flag) {
exe->Print (1, "\t") << *line_itr;
}
line_itr->Clean ();
if (line_itr->empty ()) continue;
if (declare_flag) {
if (!Initial_Declare (*line_itr)) break;
} else if (table_flag) {
if (!Initial_Table (*line_itr)) break;
} else {
while (Get_Token (*line_itr)) {
if (!Process_Token ()) break;
}
}
}
return (true);
}
示例5: close
void FileUtils::close(Mapper * mapper) {
Strings * columnNames = mapper->getColumnNames();
for (Strings::iterator it = columnNames->begin(); it != columnNames->end();
++it) {
std::string columnName = *it;
BulkFileWriter * bulkFileWriter =
(*(mapper->getColumnsToWriters()))[columnName];
delete bulkFileWriter;
}
}
示例6: init
void PluginRegistry::init()
{
// for each directory
for( Strings::const_iterator i = _directories.begin();
i != _directories.end(); ++i )
{
const std::string& dir = *i;
LBLOG( LOG_PLUGIN ) << "Searching plugins in " << dir << std::endl;
#ifdef _WIN32
Strings files = lunchbox::searchDirectory( dir, "EqualizerCompressor*.dll");
const char DIRSEP = '\\';
#elif defined (Darwin)
Strings files = lunchbox::searchDirectory( dir,
"libEqualizerCompressor*.dylib");
Strings oldFiles = lunchbox::searchDirectory( dir,
"libeqCompressor*.dylib" );
files.insert( files.end(), oldFiles.begin(), oldFiles.end( ));
const char DIRSEP = '/';
#else
Strings files = lunchbox::searchDirectory( dir,
"libEqualizerCompressor*.so" );
Strings oldFiles = lunchbox::searchDirectory( dir, "libeqCompressor*.so" );
files.insert( files.end(), oldFiles.begin(), oldFiles.end( ));
const char DIRSEP = '/';
#endif
// for each file found in the directory
for( Strings::const_iterator j = files.begin(); j != files.end(); ++j )
{
// build path + name of library
const std::string libraryName =
dir.empty() ? *j : dir + DIRSEP + *j;
addPlugin( libraryName );
}
}
for( Plugins::const_iterator i = _plugins.begin(); i != _plugins.end(); ++i)
{
Plugin* plugin = *i;
plugin->initChildren();
}
}
示例7: discoverLocal
void Display::discoverLocal( Config* config )
{
Node* node = config->findAppNode();
EQASSERT( node );
if( !node )
return;
const Pipes& pipes = node->getPipes();
EQASSERT( !pipes.empty( ));
if( pipes.empty( ))
return;
Pipe* pipe = pipes.front();
Window* window = new Window( pipe );
window->setViewport( Viewport( .25f, .2f, .5f, .5f ));
window->setName( pipe->getName() + " window" );
window->setIAttribute( Window::IATTR_PLANES_STENCIL, 1 );
Channel* channel = new Channel( window );
channel->setName( pipe->getName() + " channel" );
Observer* observer = new Observer( config );
const PixelViewport& pvp = pipe->getPixelViewport();
Wall wall;
if( pvp.isValid( ))
wall.resizeHorizontalToAR( float( pvp.w ) / float( pvp.h ));
Canvas* canvas = new Canvas( config );
canvas->setWall( wall );
Segment* segment = new Segment( canvas );
segment->setChannel( channel );
Strings names;
names.push_back( EQ_SERVER_CONFIG_LAYOUT_2D_DYNAMIC );
names.push_back( EQ_SERVER_CONFIG_LAYOUT_SIMPLE );
names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_DS );
names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_STATIC );
names.push_back( EQ_SERVER_CONFIG_LAYOUT_DB_DYNAMIC );
names.push_back( EQ_SERVER_CONFIG_LAYOUT_2D_STATIC );
for( StringsCIter i = names.begin(); i != names.end(); ++i )
{
Layout* layout = new Layout( config );
layout->setName( *i );
View* view = new View( layout );
view->setObserver( observer );
view->setWall( wall );
canvas->addLayout( layout );
}
config->activateCanvas( canvas );
}
示例8: get_part_of_sampling_space
ProteinsAnchorsSamplingSpace get_part_of_sampling_space(
const ProteinsAnchorsSamplingSpace &prots_ss, const Strings &prot_names) {
ProteinsAnchorsSamplingSpace ret(multifit::get_partial_proteomics_data(
prots_ss.get_proteomics_data(), prot_names));
ret.set_anchors(prots_ss.get_anchors());
// add the paths
for (Strings::const_iterator it = prot_names.begin(); it != prot_names.end();
it++) {
ret.set_paths_for_protein(*it, prots_ss.get_paths_for_protein(*it));
}
return ret;
}
示例9:
bool
OracleDialect::table_exists(SqlConnection &conn, const String &table)
{
Strings s = get_tables(conn);
for (Strings::iterator i = s.begin(); i != s.end(); ++i)
{
if (*i == table)
{
return true;
}
}
return false;
}
示例10: deleteFile
void FileUtils::deleteFile(std::string bulkDirectory, Mapper * mapper) {
Strings * columnNames = mapper->getColumnNames();
for (Strings::iterator it = columnNames->begin(); it != columnNames->end();
++it) {
std::string columnName = *it;
std::string fileName = mapper->getFilename(bulkDirectory, columnName);
std::ifstream columnFile(fileName.c_str());
if (columnFile.good()) {
columnFile.close();
remove(fileName.c_str());
}
}
}
示例11: Start_Execution
int Execution_Service::Start_Execution (Strings keys)
{
Str_Itr key_itr;
char *config_file;
Program_Status (RUNNING);
Show_Banner ();
//---- check for a config file ----
config_file = get_env ("TRANSIMS_CONFIG_FILE");
if (config_file != 0) {
if (!Read_Control_File (config_file)) {
return (Return_Code ());
}
}
//---- process the control keys ----
for (key_itr = keys.begin (); key_itr != keys.end (); key_itr++) {
Process_Control_String (key_itr->c_str ());
}
//---- open the output report ----
if (Check_Control_Key (TITLE)) {
Title (Get_Control_String (TITLE));
}
Open_Report (Get_Control_String (REPORT_DIRECTORY), Get_Control_String (REPORT_FILE), Set_Control_Flag (REPORT_FLAG));
if (report_flag) Read_Reports ();
set_new_handler (Insufficient_Memory);
//---- start processing ----
Program_Control ();
if (report_flag) {
List_Reports ();
} else if (!Highest_Control_Group (PROGRAM_REPORTS, 0)) {
Print (1);
Flush ();
}
Execute ();
return (Return_Code ());
}
示例12: Add_Breaks
bool Data_Range::Add_Breaks (string text)
{
int low, high;
double d1, d2;
Strings breaks;
Str_Itr itr;
//---- check for special conditions ----
if (text.empty () || text [0] == '\n') return (true);
if (String_Ptr (text)->Equals ("None")) {
return (Add_Range (minimum, maximum));
}
//---- unpack the break string ----
low = minimum;
String_Ptr (text)->Parse (breaks);
for (itr = breaks.begin (); itr != breaks.end (); itr++) {
if (!String_Ptr (*itr)->Range (d1, d2)) continue;
if (d1 == 0.0 && d2 == 0.0) continue;
if (d2 > d1) goto break_error;
high = DTOI (d2 * factor);
if (low > high || low < minimum || high > maximum) goto break_error;
if (low < high) {
if (!Add_Range (low, high)) return (false);
}
low = high;
}
high = maximum;
if (low < high) {
return (Add_Range (low, high));
}
return (Num_Ranges () > 0);
break_error:
if (exe->Send_Messages ()) {
exe->Error (String ("Range Breaks %s are Illogical") % text);
}
return (false);
}
示例13: normalizeLines
static void normalizeLines(Strings& in, StringsSet& out, bool sortWords, bool ignoreBlankLines,
char wordsep = ' ') {
Strings::iterator begin = in.begin(), end = in.end(), i = begin, o = begin;
for (; i != end; ++i) {
std::string& line = *i;
normalizeLine(line, sortWords, wordsep);
bool empty = ignoreBlankLines && line.empty();
if (!empty) {
out.insert(line);
if (i != o) *o = std::move(*i);
++o;
}
}
in.erase(o, end);
}
示例14: open
void FileUtils::open(std::string bulkDirectory, Mapper * mapper) {
// create directory with read/write/search permissions for owner and group,
// and with read/search permissions for others.
mkdir(bulkDirectory.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
std::map<std::string, BulkFileWriter *> * columnsToWriters = new std::map<
std::string, BulkFileWriter *>();
Strings * columnNames = mapper->getColumnNames();
for (Strings::iterator it = columnNames->begin(); it != columnNames->end();
++it) {
std::string columnName = *it;
std::string fileName = mapper->getFilename(bulkDirectory, columnName);
(*columnsToWriters)[columnName] = new BulkFileWriter(fileName);
}
mapper->setColumnsToWriters(columnsToWriters);
}
示例15: initialize
bool FfmpegOutput::initialize(const Attributes &attributes)
{
FfmpegResources::instance().registerAll();
queryFormats();
Strings avFormats;
for(int i=0; i<m_avFormats.size(); ++i)
{
avFormats.push_back(m_avFormats[i].name);
}
//default mp4
// std::string avFormatName="mp4";
// std::string avFormatName="h264";
std::string avFormatName="f4v";
// std::string avFormatName="flv";
Strings::iterator iter=std::find(avFormats.begin(), avFormats.end(), avFormatName);
if(iter == avFormats.end())
avFormatName=avFormats[0];
m_enabled=false;
m_recording=false;
m_audioRecording=false;
addAttribute("enable", false);
addAttribute("outputFormat", avFormatName, avFormats);
addAttribute("outputLocation", "untitled.mp4");
// addAttribute("outputLocation", "test.mp4");
// addAttribute("outputLocation", "test.h264");
// addAttribute("outputLocation", "rtmp://localhost/live/test");
// addAttribute("outputLocation", "rtmp://localhost:1935/live/stream");
m_bufferSampleId=MediaSampleFactory::getTypeId("BufferSample");
m_ffmpegPacketSampleId=MediaSampleFactory::getTypeId("FfmpegPacketSample");
m_eventSampleId=Limitless::MediaSampleFactory::getTypeId("EventSample");
m_videoSinkPad=addSinkPad("Sink", "[{\"mime\":\"video/*\"}, {\"mime\":\"image/*\"}]");
m_audioSinkPad=addSinkPad("AudioSink", "[{\"mime\":\"audio/raw\"}]");
// addSinkPad("[{\"mime\":\"audio/*\"}]");
return true;
}