您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ unit函数代码示例

51自学网 2021-06-03 09:10:12
  C++
这篇教程C++ unit函数代码示例写得很实用,希望能帮到您。

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

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

示例1: auto_

WLength::WLength(const char *s)  : auto_(false),    unit_(Pixel),    value_(-1){   char *end = 0;#ifndef WT_TARGET_JAVA  value_ = strtod(s, &end);#else  Utils::stringToDouble(s, &end, value_);#endif  if (s == end) {    LOG_ERROR("cannot parse CSS length: '" << s << "'");    auto_ = true;    return;  }    std::string unit(end);  boost::trim(unit);    if (unit == "em")    unit_ = FontEm;  else if (unit == "ex")    unit_ = FontEx;  else if (unit.empty() || unit == "px")    unit_ = Pixel;  else if (unit == "in")    unit_ = Inch;   else if (unit == "cm")    unit_ = Centimeter;   else if (unit == "mm")    unit_ = Millimeter;   else if (unit == "pt")    unit_ = Point;   else if (unit == "pc")    unit_ = Pica;   else if (unit == "%")    unit_ = Percentage;  else {    LOG_ERROR("unrecognized unit in '" << s << "'");    auto_ = true;    value_ = -1;    unit_ = Pixel;  }}
开发者ID:NeilNienaber,项目名称:wt,代码行数:46,


示例2: add_

carryover::carryover(const config& side)		: add_(side["add"].to_bool())		, color_(side["color"])		, current_player_(side["current_player"])		, gold_(side["gold"].to_int())		, name_(side["name"])		, previous_recruits_()		, recall_list_()		, save_id_(side["save_id"]){	std::vector<std::string> temp_recruits = utils::split(side["previous_recruits"], ',');	previous_recruits_.insert(temp_recruits.begin(), temp_recruits.end());	BOOST_FOREACH(const config& u, side.child_range("unit")){		recall_list_.push_back(unit(u));	}}
开发者ID:Coffee--,项目名称:wesnoth-old,代码行数:17,


示例3: bcMapping

TransRec::TransRec(SrcKey                      _src,                   TransID                     transID,                   TransKind                   _kind,                   TCA                         _aStart,                   uint32_t                    _aLen,                   TCA                         _acoldStart,                   uint32_t                    _acoldLen,                   TCA                         _afrozenStart,                   uint32_t                    _afrozenLen,                   RegionDescPtr               region,                   std::vector<TransBCMapping> _bcMapping,                   Annotations&&               _annotations,                   bool                        _hasLoop)  : bcMapping(_bcMapping)  , annotations(std::move(_annotations))  , funcName(_src.func()->fullName()->data())  , src(_src)  , md5(_src.func()->unit()->md5())  , aStart(_aStart)  , acoldStart(_acoldStart)  , afrozenStart(_afrozenStart)  , aLen(_aLen)  , acoldLen(_acoldLen)  , afrozenLen(_afrozenLen)  , bcStart(_src.offset())  , id(transID)  , kind(_kind)  , hasLoop(_hasLoop){  if (funcName.empty()) funcName = "Pseudo-main";  if (!region) return;  assertx(!region->empty());  for (auto& block : region->blocks()) {    auto sk = block->start();    blocks.emplace_back(Block{sk.unit()->md5(), sk.offset(),                              block->last().advanced().offset()});  }  auto& firstBlock = *region->blocks().front();  for (auto const& pred : firstBlock.typePreConditions()) {    guards.emplace_back(show(pred));  }}
开发者ID:MatmaRex,项目名称:hhvm,代码行数:45,


示例4: unit

QString MATMLReader::processUnits(QDomElement units){    QString unit("");    QDomNodeList children = units.childNodes();    for (int u=0;u<children.count();++u) {        if (u!=0) unit += " ";        QDomElement e = children.at(u).toElement();        int power = e.attribute("power", "1").toInt();        if (power==1) {            unit += e.text();        } else {            unit += e.text();            unit += "^";            unit += QString().setNum(power);        }    }    return unit;}
开发者ID:Negusbuk,项目名称:MatDB,代码行数:18,


示例5: TEST_F

TEST_F( TranslationUnitTest, GoToDeclarationWorks ) {  fs::path path_to_testdata = fs::current_path() / fs::path( "testdata" );  fs::path test_file = path_to_testdata / fs::path( "goto.cpp" );  TranslationUnit unit( test_file.string(),                        std::vector< UnsavedFile >(),                        std::vector< std::string >(),                        clang_index_ );  Location location = unit.GetDeclarationLocation(                        17,                        3,                        std::vector< UnsavedFile >() );  EXPECT_EQ( 12, location.line_number_ );  EXPECT_EQ( 8, location.column_number_ );  EXPECT_TRUE( !location.filename_.empty() );}
开发者ID:AaronPlay,项目名称:YouCompleteMe,代码行数:18,


示例6: stream

// The input is something like this:// 5.0000000000n   226.6820055575m   71.3468319456m  -71.3468319456m// The first number is transient simulation time, the rest are variables that// need to be converted to doublevector<double> Hspice::parse(string s) {  vector<double> result;  string word;  string str = s;  if (s.c_str()[s.length() - 1] == unluckyThirteen) { // guess what this does!    str = s.substr(0, s.length() - 1);  }  stringstream stream(str);  while (getline(stream, word, ' ')) {    if (!is_only_ascii_whitespace(word)) {      double d;      stringstream ss(word);      ss >> d;      char c = word.c_str()[word.length() - 1];      d = d * unit(c);      result.push_back(d);    }  }
开发者ID:ahmadyan,项目名称:Duplex,代码行数:22,


示例7: frame

void frame (float Vx, float Vy, float Vcx, float Vcy,			float Wx, float Wy, float Wcx, float Wcy,			mat result) {	unit (result);	mat R, T1;	move(-Vcx, -Vcy, R);	times(R, result, T1);	set(T1, result);	scaleOverPivot(Wx/Vx, Wy/Vy, R);	times(R, result, T1);	set(T1, result);	reflectHorizontally(0, R);	times(R, result, T1);	set(T1, result);	move(Wcx, Wcy, R);	times(R, result, T1);	set(T1, result);}
开发者ID:Praytic,项目名称:university-activity,代码行数:18,


示例8: EXCEPTION_ASSERT_WITH_LOG

bool GunneboReaderProvider::refreshReaderList(){    d_readers.clear();    std::vector<boost::shared_ptr<SerialPortXml> > ports;    EXCEPTION_ASSERT_WITH_LOG(SerialPortXml::EnumerateUsingCreateFile(ports), LibLogicalAccessException, "Can't enumerate the serial port list.");    for (std::vector<boost::shared_ptr<SerialPortXml> >::iterator i = ports.begin(); i != ports.end(); ++i)    {        boost::shared_ptr<GunneboReaderUnit> unit(new GunneboReaderUnit());        boost::shared_ptr<SerialPortDataTransport> dataTransport = boost::dynamic_pointer_cast<SerialPortDataTransport>(unit->getDataTransport());        dataTransport->setSerialPort(*i);        unit->setReaderProvider(boost::weak_ptr<ReaderProvider>(shared_from_this()));        d_readers.push_back(unit);    }    return true;}
开发者ID:BobLC,项目名称:liblogicalaccess,代码行数:18,


示例9: main

int main(){	int t;	while (scanf("%d", &t) != -1)	{		for (int i = 0; i < t; i++)		{			long long int sum = 0,n;			scanf("%I64d", &n);			long long int grps = n / 3;			for (int j = 1; j <= grps; j++)			{				sum += unit(j, n);			}			printf("%I64d", sum);		}	}}
开发者ID:lonelam,项目名称:LearnC,代码行数:18,


示例10: main

int main(){#ifndef ONLINE_JUDGE    freopen("in.txt", "r", stdin);#endif    char a[MAXM],b[MAXM];    int cnt=0;    init();    memset(p,-1,sizeof(p));    memset(d,0,sizeof(d));    while(scanf("%s %s",a,b)==2)    {        int pa=sear(a),pb=sear(b);        if(pa==-1)        {            insert(a,cnt);            pa=cnt++;        }        if(pb==-1)        {            insert(b,cnt);            pb=cnt++;        }        unit(pa,pb);        d[pa]++;        d[pb]++;    }    bool flag=true;    int p0=find(0);    for(int i=1; i<cnt && flag; i++)    {        if(p0!=find(i)) flag=false;    }    int cnte=0;    for(int i=0; i<cnt && flag; i++)    {        if(d[i]%2==1)   cnte++;    }    if(flag && (cnte==0 || cnte==2))        printf("Possible/n");    else        printf("Impossible/n");    return 0;}
开发者ID:tangyao0792,项目名称:ACM_Solutions,代码行数:44,


示例11: filenames

void LocalAssetBrowser::AddBitmap_continued(AIFilePicker* filepicker){	if (!filepicker->hasFilename())		return;	bool change_happened = false;	std::vector<std::string> const& filenames(filepicker->getFilenames());	for(std::vector<std::string>::const_iterator filename = filenames.begin(); filename != filenames.end(); ++filename)	{		LocalBitmap unit(*filename);		if (unit.getIfValidBool())		{			loaded_bitmaps.push_back(unit);			change_happened = true;		}	}	if (change_happened) onChangeHappened();}
开发者ID:hades187,项目名称:singu,代码行数:19,


示例12: beginDefineGuards

void SourceGenerator::run(){    beginDefineGuards();    writeInclude(getUnitFileBasename() + ".h");    writeInclude("../../utils/ccdictionarybuilder.h");    out() << "/n";    visitCursorChildren(clang_getTranslationUnitCursor(unit()), [this]() -> CXChildVisitResult {        if (isGameRecord())            defineRecord();        if (isLocalNamespace())            return CXChildVisit_Recurse;        return CXChildVisit_Continue;    });    endDefineGuards();}
开发者ID:JoeHu,项目名称:cocos2d-x-extensions-cpp2011,代码行数:19,


示例13: unit

istream &TVector::read(istream &in) {	char buf[20],ch, ch2;	in >> ch2;	if (ch2 != 'I') {		double x,y,z;		in >> x >> ch >> y >> ch >> z;		*this=TVector(x,y,z);		if (ch2 == '<')			unit();	} else {
开发者ID:csko,项目名称:Pool,代码行数:19,


示例14: msg

void StartDialog::recentItemChanged( QIconViewItem *item ){    QString msg( recentFiles[item->index()] );    QFileInfo f( recentFiles[item->index()] );    uint s = f.size();    QString unit( "B" );    if( s > 1024 ) {	s /= 1024;	unit = "KB";    }    if ( s > 1024 ) {	s /= 1024;	unit = "MB";    }    QDateTime dt( f.lastModified() );    QString date( dt.toString( "MMMM dd hh:mm" ));    msg = QString( "%1 (%2 %3)  %4" ).arg(msg).arg(s).arg(unit).arg(date);    fileInfoLabel->setText( msg );}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:19,


示例15: bcMapping

TransRec::TransRec(SrcKey                      _src,                   TransKind                   _kind,                   TCA                         _aStart,                   uint32_t                    _aLen,                   TCA                         _acoldStart,                   uint32_t                    _acoldLen,                   TCA                         _afrozenStart,                   uint32_t                    _afrozenLen,                   RegionDescPtr               region,                   std::vector<TransBCMapping> _bcMapping,                   bool                        _isLLVM)  : bcMapping(_bcMapping)  , funcName(_src.func()->fullName()->data())  , src(_src)  , md5(_src.func()->unit()->md5())  , aStart(_aStart)  , acoldStart(_acoldStart)  , afrozenStart(_afrozenStart)  , aLen(_aLen)  , acoldLen(_acoldLen)  , afrozenLen(_afrozenLen)  , bcStart(_src.offset())  , id(0)  , kind(_kind)  , isLLVM(_isLLVM){  if (funcName.empty()) funcName = "Pseudo-main";  if (!region) return;  assertx(!region->empty());  for (auto& block : region->blocks()) {    auto sk = block->start();    blocks.emplace_back(Block{sk.unit()->md5(), sk.offset(),                              block->last().advanced().offset()});  }  auto& firstBlock = *region->blocks().front();  auto guardRange = firstBlock.typePreds().equal_range(firstBlock.start());  for (; guardRange.first != guardRange.second; ++guardRange.first) {    guards.emplace_back(show(guardRange.first->second));  }}
开发者ID:AmritanshuRanjan,项目名称:hhvm,代码行数:43,


示例16: DLLPublishToPython

DllExport void DLLPublishToPython(){	CyEnumsPythonInterface();	CyGamePythonInterface();	CyRandomPythonInterface();	CyTeamPythonInterface();	CyAreaPythonInterface();	CyStructsPythonInterface1();	CyMapPythonInterface();	CyMapGeneratorPythonInterface();	CySelectionGroupInterface();	CyArtFileMgrPythonInterface();	CyGameTextMgrInterface();	CyInfoPythonInterface1();	CyInfoPythonInterface2();	CyInfoPythonInterface3();	CyHallOfFameInterface();	CyGameCoreUtilsPythonInterface();	CyMessageControlInterface();	//	// large interfaces which can be split across files if need be	//	python::class_<CyCity> city ("CyCity");		// define city class	CyCityPythonInterface1(city);				// publish it's methods	python::class_<CyPlayer> player ("CyPlayer");	// define player class	CyPlayerPythonInterface1(player);				// publish it's methods	CyPlayerPythonInterface2(player);				// publish it's methods	python::class_<CyUnit> unit ("CyUnit");		// define unit class	CyUnitPythonInterface1(unit);				// publish it's methods	python::class_<CyPlot> plot ("CyPlot");		// define plot class	CyPlotPythonInterface1(plot);				// publish it's methods	python::class_<CyGlobalContext> gc ("CyGlobalContext");	// define globals class 	CyGlobalContextPythonInterface1(gc);					// publish it's methods 	CyGlobalContextPythonInterface2(gc);					// publish it's methods	CyGlobalContextPythonInterface3(gc);					// publish it's methods	CyGlobalContextPythonInterface4(gc);					// publish it's methods }
开发者ID:Carboniferous,项目名称:AltAI,代码行数:42,


示例17: frame

void frame (float Vx, float Vy, float Vcx, float Vcy, float Wx, float Wy, float Wcx, float Wcy, mat &c){	unit(c);	mat R, t;	///	move(-Vcx, -Vcy, R);	times(R, c, t);	set(t,c);	///	scalef(Wx / Vx, Wy / Vy, R);	times(R, c, t);	set(t,c);	///	mirrorf( 1, 0, c);	times(R, c, t);	set(t,c);	///	move(Wcx, Wcy, R);	times(R, c, t);	set(t,c);}
开发者ID:ooow,项目名称:Computer-graphics,代码行数:20,


示例18: EXCEPTION_ASSERT_WITH_LOG

    bool STidSTRReaderProvider::refreshReaderList()    {        //LOG(LogLevel::INFOS) << "Refreshing reader list...");        d_readers.clear();        std::vector<std::shared_ptr<SerialPortXml> > ports;        EXCEPTION_ASSERT_WITH_LOG(SerialPortXml::EnumerateUsingCreateFile(ports), LibLogicalAccessException, "Can't enumerate the serial port list.");        for (std::vector<std::shared_ptr<SerialPortXml> >::iterator i = ports.begin(); i != ports.end(); ++i)        {            std::shared_ptr<STidSTRReaderUnit> unit(new STidSTRReaderUnit());            std::shared_ptr<SerialPortDataTransport> dataTransport = std::dynamic_pointer_cast<SerialPortDataTransport>(unit->getDataTransport());            dataTransport->setSerialPort(*i);            unit->setReaderProvider(std::weak_ptr<ReaderProvider>(shared_from_this()));            d_readers.push_back(unit);            //LOG(LogLevel::INFOS) << "--> Detected reader unit {%s}...", dynamic_cast<XmlSerializable*>(&(*unit))->serialize().c_str());        }        return true;    }
开发者ID:islog,项目名称:liblogicalaccess,代码行数:20,


示例19: if

//内包判定bool Quad2::contains(const t_Vec2& v) const{	t_Vec2 n,p;	ValueType dp;	ValueType dp_sign=0;	for(int i=0;i<4;i++){		//
C++ unitChanged函数代码示例
C++ uniqs函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。