本文整理汇总了C++中vstring类的典型用法代码示例。如果您正苦于以下问题:C++ vstring类的具体用法?C++ vstring怎么用?C++ vstring使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vstring类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: U8sToWcs
wvstring U8sToWcs(const vstring &src){
wvstring ret;
const int nConvLen = ::MultiByteToWideChar(CP_UTF8, 0, src.c_str(), src.size(), nullptr, 0);
if(nConvLen > 0){
ret.resize(nConvLen);
ret.resize(::MultiByteToWideChar(CP_UTF8, 0, src.c_str(), src.size(), &ret[0], nConvLen));
}
return std::move(ret);
}
示例2: flatten
/*!
* @if jp
* @brief 与えられた文字列リストからCSVを生成
* @else
* @brief Create CSV file from the given string list
* @endif
*/
std::string flatten(vstring sv)
{
if (sv.size() == 0) return "";
std::string str;
for (size_t i(0), len(sv.size() - 1); i < len; ++i)
{
str += sv[i] + ", ";
}
return str + sv.back();
}
示例3: tokenize
void tokenize(const std::string str, vstring &v) {
std::string buffer;
for (int i = 0; i < str.length(); ++i) {
if (!isPunc(str[i]) && !isspace(str[i]) && str[i] != '.') {
buffer += str[i];
}
else if (!buffer.empty()) {
v.push_back(buffer);
buffer.erase();
}
}
if ((v.empty() && !buffer.empty()) || !buffer.empty()) {
v.push_back(buffer);
}
}
示例4: loadannots
void
loadannots()
{
ifstream annots;
annots.open(scangen_args.phenotype_arg);
if (annots.fail()){
cerr << "Cannot open phenotype file: " << strerror(errno) << endl;
exit(EXIT_FAILURE);
}
back_insert_iterator<vstring> dest(phenos);
copy(iisstring(annots),iisstring(),dest);
annots.close();
ifstream glist;
if (species=="droso"){
cout << "Reading droso genes list..." << endl;
glist.open( (scangen_datapath+"/droso/annot/genelist.dat").c_str() );
} else if (species=="eutherian"){
cout << "Reading eutherian genes list..." << endl;
glist.open( (scangen_datapath+"/eutherian/annot/genelist.dat").c_str() );
}
if (glist.fail()){
cerr << "Cannot open gene list file: " << strerror(errno) << endl;
exit(EXIT_FAILURE);
}
back_insert_iterator<vstring> destg(gbacks);
copy(iisstring(glist),iisstring(),destg);
glist.close();
for (ivstring ivs=phenos.begin();ivs!=phenos.end();ivs++){
for (ivstring ivs2=gbacks.begin();ivs2!=gbacks.end();ivs2++){
if (*ivs2==*ivs){
gbacks.erase(ivs2);
break;
}
}
}
// for (ivstring ivs=phenos.begin();ivs!=phenos.end();ivs++){
// cout << *ivs << endl;
// }
}
示例5: rfind
int rfind(vstring v, std::string str) {
int start = v.size() - 1;
for(int i = start; i >= 0; --i) {
if(v[i] == str) {
return start - i;
}
}
return -1;
}
示例6: find
int find(vstring v, std::string str) {
int iLim = v.size();
for(int i = 0; i < iLim; ++i) {
if(v[i] == str) {
return i;
}
}
return -1;
}
示例7: tokenize
void Tokenizer::tokenize( vstring &v ) {
if(buffer.length() == 0) {
return;
}
resetPosition();
for( ; firstToken() != ""; v.push_back(thisToken))
;
resetPosition();
}
示例8: includes
/*!
* @if jp
* @brief 文字列リスト中にある文字列が含まれるかどうかを判断する
* @else
* @brief Include if a string is included in string list
* @endif
*/
bool includes(const vstring& list, std::string value, bool ignore_case)
{
if (ignore_case) { toLower(value); }
for (int i(0), len(static_cast<int>(list.size())); i < len; ++i)
{
std::string str(list[i]);
if (ignore_case) { toLower(str); }
if (str == value) return true;
}
return false;
}
示例9: copy
// copy the content of a string array to a vector
void copy(char *array[], vstring &v, size_t array_size)
{
for(int i = 0; i < array_size; ++i)
{
if(array[i] != NULL)
{
v.push_back(array[i]);
}
else
{
break;
}
}
}
示例10: comppheno
void
comppheno()
{
// attribute phenotype to CRMs
for (unsigned int i=0;i<nbchrom;i++){
for (ivginst ivg=groupedinst[i].begin();ivg!=groupedinst[i].end();ivg++){
(*ivg).isdiscarded();
if (!(*ivg).discarded){
for (ivstring ivs=phenos.begin();ivs!=phenos.end();ivs++){
if ((*ivg).besttss.gene==*ivs){
(*ivg).goodpheno=1;
break;
} else {
(*ivg).goodpheno=0;
}
}
} else {
(*ivg).goodpheno=0;
}
}
}
return;
}
示例11: verify_context
// handle the context of the conversation
// (the previous replies of the chatterbot)
void Eliza::verify_context(vstring vContext) {
m_bGoodContext = 0;
size_t nNum = vContext.size();
if(nNum == 0) {
m_bGoodContext = 1;
return;
}
for(int i = 0; i < nNum; ++i) {
if(is_template(vContext[i])) {
findSymbol(vContext[i]);
replace(vContext[i], m_sSymbol, m_sSuffix);
}
if(m_sPrevResponse == vContext[i]) {
m_bGoodContext = 1;
break;
}
}
}
示例12: copy
void copy(char *array[], vstring &v) {
for(int i = 0; i < MAX_RESP; ++i) {
v.push_back(array[i]);
}
}
示例13: unique_sv
/*!
* @if jp
* @brief 与えられた文字列リストから重複を削除
* @else
* @brief Eliminate duplication from the given string list
* @endif
*/
vstring unique_sv(vstring sv)
{
return std::for_each(sv.begin(), sv.end(), unique_strvec()).str;
}
示例14: saveTopic
void Eliza::saveTopic(const vstring vList, const std::string sSymbol) {
int listSize = vList.size();
for(int i = 0; i < listSize; ++i) {
scriptfile << sSymbol << vList[i] << std::endl;
}
}
示例15: add_response
void Eliza::add_response(vstring v) {
int size = v.size();
for(int i = 0; i < size; ++i) {
response_list.push_back(v[i]);
}
}