当前位置: 首页>>代码示例>>C++>>正文


C++ endsWith函数代码示例

本文整理汇总了C++中endsWith函数的典型用法代码示例。如果您正苦于以下问题:C++ endsWith函数的具体用法?C++ endsWith怎么用?C++ endsWith使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了endsWith函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Java_java_lang_Class_classForName

Class* Java_java_lang_Class_classForName(Env* env, Class* cls, Object* className, jboolean initializeBoolean,
            ClassLoader* classLoader) {

    if (!className) {
        rvmThrowNullPointerException(env);
        return NULL;
    }
    char* classNameUTF = toBinaryName(env, className);
    if (!classNameUTF) return NULL;
    Class* clazz = rvmFindClassUsingLoader(env, classNameUTF, classLoader);
    if (!clazz) {
        // FIXME: Temp fix to prevent warnings from the ObjC bridge about missing XXX$Callbacks classes
        if (!endsWith(classNameUTF, "$Callbacks")) {
            char* p = classNameUTF;
            while (*p != '\0') {
                if (*p == '/') *p = '.';
                p++;
            }
            WARNF("Class.forName() failed to load '%s'. "
                  "Use the -forcelinkclasses command line option "
                  "or add <forceLinkClasses><pattern>%s</pattern></forceLinkClasses> "
                  "to your robovm.xml file to link it in.",
                  classNameUTF, classNameUTF);
        }
        return NULL;
    }
    if (initializeBoolean) {
        rvmInitialize(env, clazz);
        if (rvmExceptionCheck(env)) return NULL;
    }
    return clazz;
}
开发者ID:Custard7,项目名称:robovm,代码行数:32,代码来源:java_lang_Class.c

示例2: p

    bool Scope::execFile( const string& filename , bool printResult , bool reportError , bool assertOnError, int timeoutMs ){
        
        path p( filename );

        if ( ! exists( p ) ){
            log() << "file [" << filename << "] doesn't exist" << endl;
            if ( assertOnError )
                assert( 0 );
            return false;
        }

        // iterate directories and recurse using all *.js files in the directory
        if ( is_directory( p ) ){
            directory_iterator end;
            bool empty = true;
            for (directory_iterator it (p); it != end; it++){
                empty = false;
                path sub (*it);
                if (!endsWith(sub.string().c_str(), ".js"))
                    continue;
                if (!execFile(sub.string().c_str(), printResult, reportError, assertOnError, timeoutMs))
                    return false;
            }

            if (empty){
                log() << "directory [" << filename << "] doesn't have any *.js files" << endl;
                if ( assertOnError )
                    assert( 0 );
                return false;
            }

            return true;
        }
        
        File f;
        f.open( filename.c_str() , true );

        unsigned L;
        {
            fileofs fo = f.len();
            assert( fo <= 0x7ffffffe );
            L = (unsigned) fo;
        }
        boost::scoped_array<char> data (new char[L+1]);
        data[L] = 0;
        f.read( 0 , data.get() , L );

        int offset = 0;
        if (data[0] == '#' && data[1] == '!'){
            const char* newline = strchr(data.get(), '\n');
            if (! newline)
                return true; // file of just shebang treated same as empty file
            offset = newline - data.get();
        }

        StringData code (data.get() + offset, L - offset);
        
        return exec( code , filename , printResult , reportError , assertOnError, timeoutMs );
    }
开发者ID:meganyao,项目名称:mongo,代码行数:59,代码来源:engine.cpp

示例3: OGR_F_GetStyleString

Object* OgrFileImport::importPointGeometry(MapPart* map_part, OGRFeatureH feature, OGRGeometryH geometry)
{
	auto style = OGR_F_GetStyleString(feature);
	auto symbol = getSymbol(Symbol::Point, style);
	if (symbol->getType() == Symbol::Point)
	{
		auto object = new PointObject(symbol);
		object->setPosition(toMapCoord(OGR_G_GetX(geometry, 0), OGR_G_GetY(geometry, 0)));
		map_part->addObject(object);
		return object;
	}
	else if (symbol->getType() == Symbol::Text)
	{
		const auto& description = symbol->getDescription();
		auto length = description.length();
		auto split = description.indexOf(QLatin1Char(' '));
		Q_ASSERT(split > 0);
		Q_ASSERT(split < length);
		
		auto label = description.right(length - split - 1);
		if (label.startsWith('{') && label.endsWith('}'))
		{
			label.remove(0,1);
			label.chop(1);
			int index = OGR_F_GetFieldIndex(feature, label.toLatin1());
			if (index >= 0)
			{
				label = QString(OGR_F_GetFieldAsString(feature, index));
			}
		}
		if (!label.isEmpty())
		{
			auto object = new TextObject(symbol);
			object->setAnchorPosition(toMapCoord(OGR_G_GetX(geometry, 0), OGR_G_GetY(geometry, 0)));
			// DXF observation
			label.replace(QRegularExpression("(\\\\[^;]*;)*", QRegularExpression::MultilineOption), QString::null);
			label.replace(QLatin1String("^I"), "\t");
			object->setText(label);
			
			bool ok;
			auto anchor = QStringRef(&description, 1, 2).toInt(&ok);
			if (ok)
			{
				applyLabelAnchor(anchor, object);
			}
				
			auto angle = QStringRef(&description, 3, split-3).toFloat(&ok);
			if (ok)
			{
				object->setRotation(qDegreesToRadians(angle));
			}
			
			map_part->addObject(object);
			return object;
		}
	}
	
	return nullptr;
}
开发者ID:999999333,项目名称:mapper,代码行数:59,代码来源:ogr_file_format.cpp

示例4: derelativizeURL

void
derelativizeURL (char* tok, char* url, RDFFile f)
{
  if ((tok[0] == '/') && (endsWith(".mco", tok))) {
	void stringAppendBase (char* dest, const char* addition) ;
    stringAppendBase(url, f->url); 
    stringAppend(url, "#");
    stringAppend(url, tok);
  } else if  ((endsWith(".mco", tok)) && (charSearch('#', tok) == -1)) {
    void stringAppendBase (char* dest, const char* addition) ;
    stringAppendBase(url, f->url);
    stringAppend(url, "#");
    stringAppend(url, tok);
  } else {
    memcpy(url, tok, strlen(tok));
  }
}
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:17,代码来源:mcff2mcf.c

示例5: endsWith

/* Member function ofbitstream::open
 * -------------------------------------------
 * Attempts to open the specified file, failing if unable
 * to do so.
 */
void ofbitstream::open(const char* filename) {
    /* Confirm we aren't about to do something that could potentially be a
    * Very Bad Idea.
    */
    if (endsWith(filename, ".cpp") || endsWith(filename, ".h") ||
            endsWith(filename, ".hh") || endsWith(filename, ".cc")) {
        error(string("It is potentially dangerous to write to file ")
             + filename + ", because that might be your own source code.  "
             + "We are explicitly disallowing this operation.  Please choose a "
             + "different filename.");
        setstate(ios::failbit);
    } else {
        if (!fb.open(filename, ios::out | ios::binary)) {
            setstate(ios::failbit);
        }
    }
}
开发者ID:JohanssonDaniel,项目名称:Huffman,代码行数:22,代码来源:bitstream.cpp

示例6: switch

void Launcher::prepareSettings() {
#ifdef Q_OS_MAC
#ifndef OS_MAC_OLD
	if (QSysInfo::macVersion() >= QSysInfo::MV_10_11) {
		gIsElCapitan = true;
	}
#else // OS_MAC_OLD
	if (QSysInfo::macVersion() < QSysInfo::MV_10_7) {
		gIsSnowLeopard = true;
	}
#endif // OS_MAC_OLD
#endif // Q_OS_MAC

	switch (cPlatform()) {
	case dbipWindows:
#ifndef OS_WIN_STORE
		gPlatformString = qsl("Windows");
#else // OS_WIN_STORE
		gPlatformString = qsl("WinStore");
#endif // OS_WIN_STORE
	break;
	case dbipMac:
#ifndef OS_MAC_STORE
		gPlatformString = qsl("MacOS");
#else // OS_MAC_STORE
		gPlatformString = qsl("MacAppStore");
#endif // OS_MAC_STORE
	break;
	case dbipMacOld:
		gPlatformString = qsl("MacOSold");
	break;
	case dbipLinux64:
		gPlatformString = qsl("Linux64bit");
	break;
	case dbipLinux32:
		gPlatformString = qsl("Linux32bit");
	break;
	}

	auto path = Platform::CurrentExecutablePath(_argc, _argv);
	LOG(("Executable path before check: %1").arg(path));
	if (!path.isEmpty()) {
		auto info = QFileInfo(path);
		if (info.isSymLink()) {
			info = info.symLinkTarget();
		}
		if (info.exists()) {
			const auto dir = info.absoluteDir().absolutePath();
			gExeDir = (dir.endsWith('/') ? dir : (dir + '/'));
			gExeName = info.fileName();
		}
	}
	if (cExeName().isEmpty()) {
		LOG(("WARNING: Could not compute executable path, some features will be disabled."));
	}

	processArguments();
}
开发者ID:aykutalparslan,项目名称:tdesktop,代码行数:58,代码来源:launcher.cpp

示例7: if

void TestExecutor::handle(ConfigFileReader& testSettings)
{
    auto testCases = testSettings.getSettings();
    for(auto testCase: testCases)
    {
        shared_ptr<TestBase> currentTestCase;
        
        if(testCase.second.find("disabled") != testCase.second.end())
            continue;

        if(endsWith(testCase.first,"TransportTest"))
            currentTestCase.reset(new ClientTransportTest<BasicTransportTask<char*>>(testCase.first));
        else if(endsWith(testCase.first, "CreateStoreTest-AllTypes"))
            currentTestCase.reset(new CreateStoreTestAllTypes<BasicTaskExecution<shared_ptr< ::google::protobuf::Message>>>(testCase.first));
        else if(endsWith(testCase.first, "DropStoreTest-AllTypes"))
            currentTestCase.reset(new DropStoreTestAllTypes<BasicTaskExecution<shared_ptr< ::google::protobuf::Message>>>(testCase.first));
        else if(endsWith(testCase.first, "SetTest-Simple"))
            currentTestCase.reset(new SetTestSimple<BasicTaskExecution<shared_ptr< ::google::protobuf::Message>>>(testCase.first));
        else if(endsWith(testCase.first, "DeleteTest-Simple"))
            currentTestCase.reset(new DeleteTestSimple<BasicTaskExecution<shared_ptr< ::google::protobuf::Message>>>(testCase.first));
        else if(endsWith(testCase.first, "GetTest-Simple"))
            currentTestCase.reset(new GetTestSimple<BasicTaskExecution<shared_ptr< ::google::protobuf::Message>>>(testCase.first));
        else if(endsWith(testCase.first, "PruneIndexScan"))
            currentTestCase.reset(new PruneIndexScan<BasicTaskExecution<shared_ptr< ::google::protobuf::Message>>>(testCase.first));
        
        if(currentTestCase.get())
            currentTestCase->run(testCase.second);

    }
    
     FILE_LOG(logINFO)<<"Finished Tests";
}
开发者ID:ali-dar,项目名称:VoloDB,代码行数:32,代码来源:TestExecutor.cpp

示例8: if

static struct pipeline *openPslSortPipe(char *pslFile)
/* open pipeline that sorts psl */
{
    static char *zcatCmd[] = {"zcat", NULL};
    static char *bzcatCmd[] = {"zcat", NULL};
    static char *sortCmd[] = {"sort", "-k", "14,14", "-k", "16,16n", "-k", "17,17nr", NULL};
    int iCmd = 0;
    char **cmds[3];

    if (endsWith(pslFile, ".gz") || endsWith(pslFile, ".Z"))
        cmds[iCmd++] = zcatCmd;
    else if (endsWith(pslFile, ".bz2"))
        cmds[iCmd++] = bzcatCmd;
    cmds[iCmd++] = sortCmd;
    cmds[iCmd++] = NULL;

    return pipelineOpen(cmds, pipelineRead, pslFile, NULL);
}
开发者ID:Nicholas-NVS,项目名称:kentUtils,代码行数:18,代码来源:pslPartition.c

示例9: p

    bool Scope::execFile(const string& filename, bool printResult, bool reportError,
                         int timeoutMs) {
#ifdef _WIN32
        boost::filesystem::path p(toWideString(filename.c_str()));
#else
        boost::filesystem::path p(filename);
#endif
        if (!exists(p)) {
            log() << "file [" << filename << "] doesn't exist" << endl;
            return false;
        }

        // iterate directories and recurse using all *.js files in the directory
        if (boost::filesystem::is_directory(p)) {
            boost::filesystem::directory_iterator end;
            bool empty = true;

            for (boost::filesystem::directory_iterator it (p); it != end; it++) {
                empty = false;
                boost::filesystem::path sub(*it);
                if (!endsWith(sub.string().c_str(), ".js"))
                    continue;
                if (!execFile(sub.string(), printResult, reportError, timeoutMs))
                    return false;
            }

            if (empty) {
                log() << "directory [" << filename << "] doesn't have any *.js files" << endl;
                return false;
            }

            return true;
        }

        File f;
        f.open(filename.c_str(), true);
        fileofs fo = f.len();
        if (fo > kMaxJsFileLength) {
            warning() << "attempted to execute javascript file larger than 2GB" << endl;
            return false;
        }
        unsigned len = static_cast<unsigned>(fo);
        boost::scoped_array<char> data (new char[len+1]);
        data[len] = 0;
        f.read(0, data.get(), len);

        int offset = 0;
        if (data[0] == '#' && data[1] == '!') {
            const char* newline = strchr(data.get(), '\n');
            if (!newline)
                return true; // file of just shebang treated same as empty file
            offset = newline - data.get();
        }

        StringData code(data.get() + offset, len - offset);
        return exec(code, filename, printResult, reportError, timeoutMs);
    }
开发者ID:avish,项目名称:mongo,代码行数:57,代码来源:engine.cpp

示例10: inclChrom

bool inclChrom(char *name)
/* check if a chromosome should be included */
{
return  !((noRandom && (endsWith(name, "_random")
                        || startsWith("chrUn", name)
                        || sameWord("chrNA", name) /* danRer */
                        || sameWord("chrU", name)))  /* dm */
          || (noHap && haplotype(name)));
}
开发者ID:davidhoover,项目名称:kent,代码行数:9,代码来源:featureBits.c

示例11: filterFiles

void FileListerWithSuffix::filterFiles() {
	vector<string> temp = this->fileList;
	this->fileList.clear();
	for (vector<string>::iterator itr = temp.begin(); itr != temp.end(); ++itr) {
		if (endsWith(*itr, this->suffix)) {
			fileList.push_back(*itr);
		}
	}
}
开发者ID:liatgrin,项目名称:R.U.M.B.A.,代码行数:9,代码来源:FileListerWithSuffix.cpp

示例12: newBigFolder

bool DiscoveryJob::checkSelectiveSyncNewFolder(const QString &path, RemotePermissions remotePerm)
{
    if (_syncOptions._confirmExternalStorage && !_syncOptions._newFilesAreVirtual
        && remotePerm.hasPermission(RemotePermissions::IsMounted)) {
        // external storage.

        /* Note: DiscoverySingleDirectoryJob::directoryListingIteratedSlot make sure that only the
         * root of a mounted storage has 'M', all sub entries have 'm' */

        // Only allow it if the white list contains exactly this path (not parents)
        // We want to ask confirmation for external storage even if the parents where selected
        if (_selectiveSyncWhiteList.contains(path + QLatin1Char('/'))) {
            return false;
        }

        emit newBigFolder(path, true);
        return true;
    }

    // If this path or the parent is in the white list, then we do not block this file
    if (findPathInList(_selectiveSyncWhiteList, path)) {
        return false;
    }

    auto limit = _syncOptions._newBigFolderSizeLimit;
    if (limit < 0 || _syncOptions._newFilesAreVirtual) {
        // no limit, everything is allowed;
        return false;
    }

    // Go in the main thread to do a PROPFIND to know the size of this folder
    qint64 result = -1;

    {
        QMutexLocker locker(&_vioMutex);
        emit doGetSizeSignal(path, &result);
        _vioWaitCondition.wait(&_vioMutex);
    }

    if (result >= limit) {
        // we tell the UI there is a new folder
        emit newBigFolder(path, false);
        return true;
    } else {
        // it is not too big, put it in the white list (so we will not do more query for the children)
        // and and do not block.
        auto p = path;
        if (!p.endsWith(QLatin1Char('/'))) {
            p += QLatin1Char('/');
        }
        _selectiveSyncWhiteList.insert(std::upper_bound(_selectiveSyncWhiteList.begin(),
                                           _selectiveSyncWhiteList.end(), p),
            p);

        return false;
    }
}
开发者ID:bjoernv,项目名称:client,代码行数:57,代码来源:discoveryphase.cpp

示例13: createDirectory

void createDirectory(string path) {
   if (endsWith(path, "/")) {
      path = substring(path, 0, stringLength(path) - 2);
   }
   if (_mkdir(path) != 0) {
      if (errno == EEXIST && isDirectory(path)) return;
      error("createDirectory: %s", strerror(errno));
   }
}
开发者ID:cs50,项目名称:spl,代码行数:9,代码来源:winfile.c

示例14: excludedPath

bool PathMatch::match(const std::string &path) const
{
    if (path.empty())
        return false;

    for (std::vector<std::string>::const_iterator i = mExcludedPaths.begin(); i != mExcludedPaths.end(); ++i) {
        const std::string excludedPath((!Path::isAbsolute(path) && Path::isAbsolute(*i)) ? Path::getRelativePath(*i, mWorkingDirectory) : *i);

        std::string findpath = Path::fromNativeSeparators(path);
        if (!mCaseSensitive)
            std::transform(findpath.begin(), findpath.end(), findpath.begin(), ::tolower);

        // Filtering directory name
        if (endsWith(excludedPath,'/')) {
            if (!endsWith(findpath,'/'))
                findpath = removeFilename(findpath);

            if (excludedPath.length() > findpath.length())
                continue;
            // Match relative paths starting with mask
            // -isrc matches src/foo.cpp
            if (findpath.compare(0, excludedPath.size(), excludedPath) == 0)
                return true;
            // Match only full directory name in middle or end of the path
            // -isrc matches myproject/src/ but does not match
            // myproject/srcfiles/ or myproject/mysrc/
            if (findpath.find("/" + excludedPath) != std::string::npos)
                return true;
        }
        // Filtering filename
        else {
            if (excludedPath.length() > findpath.length())
                continue;
            // Check if path ends with mask
            // -ifoo.cpp matches (./)foo.c, src/foo.cpp and proj/src/foo.cpp
            // -isrc/file.cpp matches src/foo.cpp and proj/src/foo.cpp
            if (findpath.compare(findpath.size() - excludedPath.size(), findpath.size(), excludedPath) == 0)
                return true;

        }
    }
    return false;
}
开发者ID:MarcelNehring,项目名称:cppcheck,代码行数:43,代码来源:pathmatch.cpp

示例15: processDesktopInDirectory

void Index::processDesktopInDirectory(const std::string &baseDirectory, const std::string &relative, const std::vector<file> &content)
{
	for (std::vector<std::string>::size_type i = 0; i < content.size(); ++i)
	{
		if (content.at(i).type == FileType::File && endsWith(content.at(i).name, std::string(".desktop")))
		{
			processDesktopFile(baseDirectory, relative + content.at(i).name);
		}
	}
}
开发者ID:sietse,项目名称:otter-browser,代码行数:10,代码来源:Index.cpp


注:本文中的endsWith函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。