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


C++ className函数代码示例

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


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

示例1: convertToId

QByteArray convertToId(const QMetaObject *mo)
{
    QByteArray className(mo->className());
    if (!className.isEmpty())
        return convertToId(className);

    // likely a metaobject generated for an extended qml object
    if (mo->superClass()) {
        className = convertToId(mo->superClass());
        className.append("_extended");
        return className;
    }

    static QHash<const QMetaObject *, QByteArray> generatedNames;
    className = generatedNames.value(mo);
    if (!className.isEmpty())
        return className;

    std::cerr << "Found a QMetaObject without a className, generating a random name" << std::endl;
    className = QByteArray("error-unknown-name-");
    className.append(QByteArray::number(generatedNames.size()));
    generatedNames.insert(mo, className);
    return className;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:24,代码来源:main.cpp

示例2: defined

/*! \internal
  Returns the index of the signal with name \n or -1 if no such signal exists.

  If  \a super is TRUE, inherited signals are included.
*/
int QMetaObject::findSignal( const char* n, bool super ) const
{
    const QMetaObject *mo = this;
    int offset = -1;

    do {
	const QMetaData *md = mo->signalDict ? mo->signalDict->find( n ) : 0;
	if ( md ) {
#if defined(QT_CHECK_RANGE)
	    if ( offset != -1 ) {
		qWarning( "QMetaObject::findSignal:%s: Conflict with %s::%s",
			  className(), mo->className(), n );
		return offset;
	    }
#endif
	    offset = mo->signalOffset() + ( md - mo->signalData );
#if !defined(QT_CHECK_RANGE)
	    return offset;
#endif
	}
    } while ( super && (mo = mo->superclass) );

    return offset;
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:29,代码来源:qmetaobject.cpp

示例3: QObject

Task::Task(WId win, TaskManager * parent, const char *name) :
  QObject(parent, name),
  _active(false), _win(win),
  _lastWidth(0), _lastHeight(0), _lastResize(false), _lastIcon(),
  _thumbSize(0.2), _thumb(), _grab()
{
#ifdef KDE_3_2
  _info = KWin::windowInfo(_win, 0, 0);
#else
  _info = KWin::info(_win);
#endif
  // try to load icon via net_wm
  _pixmap = KWin::icon(_win, 16, 16, true);

  // try to guess the icon from the classhint
  if(_pixmap.isNull())
    KGlobal::instance()->iconLoader()->loadIcon(className().lower(),
            KIcon::Small,KIcon::Small,
            KIcon::DefaultState, 0, true);

  // load xapp icon
  if (_pixmap.isNull())
    _pixmap = SmallIcon("kcmx");
}
开发者ID:serghei,项目名称:kde3-kdeutils,代码行数:24,代码来源:taskmanager.cpp

示例4: className

	bool Log::shouldLog(CallSite& site)
	{
		LogLock lock;
		if (!lock.ok())
		{
			return false;
		}
		
		Globals& g = Globals::get();
		Settings& s = Settings::get();
		
		s.shouldLogCallCounter += 1;
		
		std::string class_name = className(site.mClassInfo);
		std::string function_name = functionName(site.mFunction);
		if (site.mClassInfo != typeid(NoClassInfo))
		{
			function_name = class_name + "::" + function_name;
		}

		ELevel compareLevel = s.defaultLevel;

		// The most specific match found will be used as the log level,
		// since the computation short circuits.
		// So, in increasing order of importance:
		// Default < Broad Tag < File < Class < Function < Narrow Tag
		((site.mNarrowTag != NULL) ? checkLevelMap(s.tagLevelMap, site.mNarrowTag, compareLevel) : false)
		|| checkLevelMap(s.functionLevelMap, function_name, compareLevel)
		|| checkLevelMap(s.classLevelMap, class_name, compareLevel)
		|| checkLevelMap(s.fileLevelMap, abbreviateFile(site.mFile), compareLevel)
		|| ((site.mBroadTag != NULL) ? checkLevelMap(s.tagLevelMap, site.mBroadTag, compareLevel) : false);

		site.mCached = true;
		g.addCallSite(site);
		return site.mShouldLog = site.mLevel >= compareLevel;
	}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:36,代码来源:llerror.cpp

示例5: abbreviateFile

	void Log::flush(std::ostringstream* out, const CallSite& site)
	{
		LogLock lock;
		if (!lock.ok())
		{
			return;
		}
		
		Globals& g = Globals::get();
		Settings& s = Settings::get();

		std::string message = out->str();
		if (out == &g.messageStream)
		{
			g.messageStream.clear();
			g.messageStream.str("");
			g.messageStreamInUse = false;
		}
		else
		{
			delete out;
		}

		if (site.mLevel == LEVEL_ERROR)
		{
			std::ostringstream fatalMessage;
			fatalMessage << abbreviateFile(site.mFile)
						<< "(" << site.mLine << ") : error";
			
			writeToRecorders(site.mLevel, fatalMessage.str());
		}
		
		
		std::ostringstream prefix;

		switch (site.mLevel)
		{
			case LEVEL_DEBUG:		prefix << "DEBUG: ";	break;
			case LEVEL_INFO:		prefix << "INFO: ";		break;
			case LEVEL_WARN:		prefix << "WARNING: ";	break;
			case LEVEL_ERROR:		prefix << "ERROR: ";	break;
			default:				prefix << "XXX: ";		break;
		};
		
		if (s.printLocation)
		{
			prefix << abbreviateFile(site.mFile)
					<< "(" << site.mLine << ") : ";
		}
		
		if (message.find(functionName(site.mFunction)) == std::string::npos)
		{
	#if LL_WINDOWS
			// DevStudio: __FUNCTION__ already includes the full class name
	#else
			if (site.mClassInfo != typeid(NoClassInfo))
			{
				prefix << className(site.mClassInfo) << "::";
			}
	#endif
			prefix << site.mFunction << ": ";
		}
		
		prefix << message;
		message = prefix.str();
		
		writeToRecorders(site.mLevel, message);
		
		if (site.mLevel == LEVEL_ERROR  &&  s.crashFunction)
		{
			s.crashFunction(message);
		}
	}
开发者ID:Boy,项目名称:netbook,代码行数:73,代码来源:llerror.cpp

示例6:

    void FSPlaceObject2::encodeToStream(FSOutputStream* aStream)
    {
        aStream->startEncoding(className());
        FSMovieObject::encodeToStream(aStream);
        
        aStream->setContext(FSStream::ColorContainsAlpha, 1);

        aStream->write(containsClipEvents() ? 1 : 0, FSStream::UnsignedBit, 1);
        aStream->write(containsClippingDepth() ? 1 : 0, FSStream::UnsignedBit, 1);
        aStream->write(containsName() ? 1 : 0, FSStream::UnsignedBit, 1);
        aStream->write(containsRatio() ? 1 : 0, FSStream::UnsignedBit, 1);
        aStream->write(containsColorTransform(aStream) ? 1 : 0, FSStream::UnsignedBit, 1);
        aStream->write(containsTransform() ? 1 : 0, FSStream::UnsignedBit, 1);
        aStream->write(place, FSStream::UnsignedBit, 2);
        aStream->write(layer, FSStream::UnsignedWord, 16);
        
        if (place == New || place == Replace)
            aStream->write(identifier, FSStream::UnsignedWord, 16);
        if (containsTransform())
            transform.encodeToStream(aStream);
        if (containsColorTransform(aStream))
            colorTransform.encodeToStream(aStream);
        if (containsRatio())
            aStream->write((int)(ratio*65535.0f), FSStream::UnsignedWord, 16);
        if (containsName())
        {
            aStream->write((byte*)name.c_str(), name.length());
            aStream->write(0, FSStream::UnsignedWord, 8);
        }
        if (containsClippingDepth())
            aStream->write(depth+1, FSStream::UnsignedWord, 16);

        if (containsClipEvents())
        {
            if (encodedLength > 0)
            {
                aStream->write(encodedEvents, encodedLength);
            }
            else
            {
                int eventSize = aStream->getContext(FSStream::Version) > 5 ? 32 : 16;
                int eventMask = 0;
                
                aStream->write(0, FSStream::UnsignedWord, 16);

                for (FSVector<FSClipEvent>::iterator i = events.begin(); i != events.end(); ++i)
                    eventMask += (*i).getEvent();
               
                aStream->write(eventMask, FSStream::UnsignedWord, eventSize);

#ifdef _DEBUG
                aStream->startEncoding("array");
#endif
                for (FSVector<FSClipEvent>::iterator i = events.begin(); i != events.end(); ++i)
                    (*i).encodeToStream(aStream);

                aStream->write(0, FSStream::UnsignedWord, eventSize);
     
#ifdef _DEBUG
                aStream->endEncoding("array");
#endif
            }
        }
        aStream->setContext(FSStream::ColorContainsAlpha, 0);
        
        aStream->endEncoding(className());
    }
开发者ID:pperehozhih,项目名称:transform-cxx,代码行数:67,代码来源:FSPlaceObject2.cpp

示例7: js_register_PluginAppnextJS_PluginAppnext

void js_register_PluginAppnextJS_PluginAppnext(JSContext *cx, JS::HandleObject global) {
    static JSClass PluginAgeCheq_class = {
        "PluginAppnext",
        JSCLASS_HAS_PRIVATE,
        nullptr
    };
    jsb_sdkbox_PluginAppnext_class = &PluginAgeCheq_class;

#if MOZJS_MAJOR_VERSION < 52
    jsb_sdkbox_PluginAppnext_class->addProperty = JS_PropertyStub;
    jsb_sdkbox_PluginAppnext_class->delProperty = JS_DeletePropertyStub;
    jsb_sdkbox_PluginAppnext_class->getProperty = JS_PropertyStub;
    jsb_sdkbox_PluginAppnext_class->setProperty = JS_StrictPropertyStub;
    jsb_sdkbox_PluginAppnext_class->enumerate = JS_EnumerateStub;
    jsb_sdkbox_PluginAppnext_class->resolve = JS_ResolveStub;
    jsb_sdkbox_PluginAppnext_class->convert = JS_ConvertStub;
    jsb_sdkbox_PluginAppnext_class->finalize = js_PluginAppnextJS_PluginAppnext_finalize;
    jsb_sdkbox_PluginAppnext_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
#endif

    static JSPropertySpec properties[] = {
        JS_PS_END
    };

    static JSFunctionSpec funcs[] = {
        JS_FS_END
    };

    static JSFunctionSpec st_funcs[] = {
        JS_FN("hideAd", js_PluginAppnextJS_PluginAppnext_hideAd, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("cacheAd", js_PluginAppnextJS_PluginAppnext_cacheAd, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("showVideo", js_PluginAppnextJS_PluginAppnext_showVideo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("refreshAds", js_PluginAppnextJS_PluginAppnext_refreshAds, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("isVideoReady", js_PluginAppnextJS_PluginAppnext_isVideoReady, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("setRewardsRewardTypeCurrency", js_PluginAppnextJS_PluginAppnext_setRewardsRewardTypeCurrency, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("isAdReady", js_PluginAppnextJS_PluginAppnext_isAdReady, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("refreshVideo", js_PluginAppnextJS_PluginAppnext_refreshVideo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("cacheVideo", js_PluginAppnextJS_PluginAppnext_cacheVideo, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("init", js_PluginAppnextJS_PluginAppnext_init, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("setRewardsTransactionId", js_PluginAppnextJS_PluginAppnext_setRewardsTransactionId, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("setRewardsUserId", js_PluginAppnextJS_PluginAppnext_setRewardsUserId, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("showAd", js_PluginAppnextJS_PluginAppnext_showAd, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("setRewardsCustomParameter", js_PluginAppnextJS_PluginAppnext_setRewardsCustomParameter, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FN("setRewardsAmountRewarded", js_PluginAppnextJS_PluginAppnext_setRewardsAmountRewarded, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
        JS_FS_END
    };

    JS::RootedObject parent_proto(cx, nullptr);
    JSObject* objProto = JS_InitClass(
        cx, global,
        parent_proto,
        jsb_sdkbox_PluginAppnext_class,
        dummy_constructor<sdkbox::PluginAppnext>, 0, // no constructor
        properties,
        funcs,
        NULL, // no static properties
        st_funcs);

    JS::RootedObject proto(cx, objProto);
#if (SDKBOX_COCOS_JSB_VERSION >= 2)
#if MOZJS_MAJOR_VERSION >= 52
    jsb_register_class<sdkbox::PluginAppnext>(cx, jsb_sdkbox_PluginAppnext_class, proto);
#else
    jsb_register_class<sdkbox::PluginAppnext>(cx, jsb_sdkbox_PluginAppnext_class, proto, JS::NullPtr());
#endif
#else
    TypeTest<sdkbox::PluginAppnext> t;
    js_type_class_t *p;
    std::string typeName = t.s_name();
    if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
    {
        p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
        p->jsclass = jsb_sdkbox_PluginAppnext_class;
        p->proto = objProto;
        p->parentProto = NULL;
        _js_global_type_map.insert(std::make_pair(typeName, p));
    }
#endif

    // add the proto and JSClass to the type->js info hash table
    JS::RootedValue className(cx);
    JSString* jsstr = JS_NewStringCopyZ(cx, "PluginAppnext");
    className = JS::StringValue(jsstr);
    JS_SetProperty(cx, proto, "_className", className);
    JS_SetProperty(cx, proto, "__nativeObj", JS::TrueHandleValue);
    JS_SetProperty(cx, proto, "__is_ref", JS::FalseHandleValue);
}
开发者ID:sdkbox,项目名称:sdkbox-sample-appnext,代码行数:87,代码来源:PluginAppnextJS.cpp

示例8: compareTo

int JViewSet::compareTo(const JObject& s) const {
  if (className() != s.className())
    return JObject::compareTo(s);
  return children.compareTo(((JViewSet*)&s)->children);
}
开发者ID:neattools,项目名称:neattools,代码行数:5,代码来源:JViewSet.cpp

示例9: compareTo

int JDouble::compareTo(const JObject& s) const {
  if (className() != s.className()) 
    return JObject::compareTo(s);
  return cmp(value, ((JDouble*)&s)->value);
}
开发者ID:neattools,项目名称:neattools,代码行数:5,代码来源:JDouble.cpp

示例10: abbreviateFile

	void Log::flush(std::ostringstream* out, const CallSite& site)
	{
		LogLock lock;
		if (!lock.ok())
		{
			return;
		}
		
		Globals& g = Globals::get();
		Settings& s = Settings::get();

		std::string message = out->str();
		if (out == &g.messageStream)
		{
			g.messageStream.clear();
			g.messageStream.str("");
			g.messageStreamInUse = false;
		}
		else
		{
			delete out;
		}

		if (site.mLevel == LEVEL_ERROR)
		{
			std::ostringstream fatalMessage;
			fatalMessage << abbreviateFile(site.mFile)
						<< "(" << site.mLine << ") : error";
			
			writeToRecorders(site.mLevel, fatalMessage.str());
		}
		
		
		std::ostringstream prefix;

		switch (site.mLevel)
		{
			case LEVEL_DEBUG:		prefix << "DEBUG: ";	break;
			case LEVEL_INFO:		prefix << "INFO: ";		break;
			case LEVEL_WARN:		prefix << "WARNING: ";	break;
			case LEVEL_ERROR:		prefix << "ERROR: ";	break;
			default:				prefix << "XXX: ";		break;
		};
		
		if (s.printLocation)
		{
			prefix << abbreviateFile(site.mFile)
					<< "(" << site.mLine << ") : ";
		}
		
	#if LL_WINDOWS
		// DevStudio: __FUNCTION__ already includes the full class name
	#else
                #if LL_LINUX
		// gross, but typeid comparison seems to always fail here with gcc4.1
		if (0 != strcmp(site.mClassInfo.name(), typeid(NoClassInfo).name()))
                #else
		if (site.mClassInfo != typeid(NoClassInfo))
                #endif // LL_LINUX
		{
			prefix << className(site.mClassInfo) << "::";
		}
	#endif
		prefix << site.mFunction << ": ";

		if (site.mPrintOnce)
		{
			std::map<std::string, unsigned int>::iterator messageIter = s.uniqueLogMessages.find(message);
			if (messageIter != s.uniqueLogMessages.end())
			{
				messageIter->second++;
				unsigned int num_messages = messageIter->second;
				if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0)
				{
					prefix << "ONCE (" << num_messages << "th time seen): ";
				} 
				else
				{
					return;
				}
			}
			else 
			{
				prefix << "ONCE: ";
				s.uniqueLogMessages[message] = 1;
			}
		}
		
		prefix << message;
		message = prefix.str();
		
		writeToRecorders(site.mLevel, message);
		
		if (site.mLevel == LEVEL_ERROR  &&  s.crashFunction)
		{
			s.crashFunction(message);
		}
	}
开发者ID:Krazy-Bish-Margie,项目名称:Thunderstorm,代码行数:98,代码来源:llerror.cpp

示例11: while

/*!\internal
 */
void QMetaObject::resolveProperty( QMetaProperty* prop )
{
    QMetaObject* super = superclass;
    while ( super ) {
	const QMetaProperty* p = super->property( prop->n );
	if( p ) {
	    if ( qstrcmp( prop->type(), p->type() ) != 0 ) {
#if defined(CHECK_STATE)
		qWarning( "QMetaObject::resolveProperty: Attempt to override property type: %s %s::%s clashes with %s %s::%s", p->type(), super->className(), p->name(), prop->type(), className(), prop->name() );
#endif
	    }
	    if ( prop->get == 0 ) {
		if ( p->get != 0 ) {
		    prop->get = p->get;
		    prop->gspec = p->gspec;
		}
	    }
	    if ( prop->set == 0 ) {
		if ( p->set != 0 ) {
		    prop->set = p->set;
		    prop->sspec = p->sspec;
		}
	    }

	    if ( prop->testFlags( QMetaProperty::UnresolvedStored ) )
	    {
		if ( !p->testFlags( QMetaProperty::UnresolvedStored ) )
		{
		    prop->clearFlags( QMetaProperty::UnresolvedStored );
		    if ( p->testFlags( QMetaProperty::NotStored ) )
			prop->setFlags( QMetaProperty::NotStored );
		    prop->store = p->store;
		}
	    }
	    if ( prop->testFlags( QMetaProperty::UnresolvedDesignable ) )
	    {
		if ( !p->testFlags( QMetaProperty::UnresolvedDesignable ) )
		{
		    prop->clearFlags( QMetaProperty::UnresolvedDesignable );
		    if ( p->testFlags( QMetaProperty::NotDesignable ) )
			prop->setFlags( QMetaProperty::NotDesignable );
		}
	    }
	}
	if ( prop->testFlags( QMetaProperty::UnresolvedEnum | QMetaProperty::UnresolvedSet | QMetaProperty::UnresolvedEnumOrSet ) ) {
	    QMetaEnum* e = super->enumerator( prop->t);
	    if ( e && e->set ) {
		if ( !prop->testFlags( QMetaProperty::UnresolvedSet | QMetaProperty::UnresolvedEnumOrSet ) ) {
#if defined(CHECK_STATE)
		    qWarning("QMetaObject::resolveProperty: The property %s %s::%s assumed that '%s' was listed in Q_ENUMS, but it was listed in Q_SETS", prop->type(), className(), prop->name(), prop->type() );
#endif
		}
		prop->enumData = e;
		prop->clearFlags( QMetaProperty::UnresolvedEnum );
	    }
	    else if ( e && !e->set ) {
		if ( !prop->testFlags( QMetaProperty::UnresolvedEnum | QMetaProperty::UnresolvedEnumOrSet ) ) {
#if defined(CHECK_STATE)
		    qWarning("QMetaObject::resolveProperty: The property %s %s::%s assumed that '%s' was listed in Q_SETS, but it was listed in Q_ENUMS", prop->type(), className(), prop->name(), prop->type() );
#endif
		}
		prop->enumData = e;
		prop->clearFlags( QMetaProperty::UnresolvedEnum );
	    }
	}
	super = super->superclass;
    }

    if ( !prop->isValid() ) {
#if defined(CHECK_STATE)
	qWarning("QMetaObject::resolveProperty: Could not resolve property %s::%s. Property not available.", className(), prop->name() );
#endif
    }
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:76,代码来源:qmetaobject.cpp

示例12: marshall_basetype


//.........这里部分代码省略.........
                m->item().s_enum = 0;
            } else if (value.instanceOf(JSmoke::Global::QtEnum)) {
                m->item().s_enum = value.property("value").toUInt32();
            } else {
                m->item().s_enum = value.toUInt32();
            }
            break;
        }
        case Marshall::ToQScriptValue:
        {
            QScriptValueList args;
            args << (uint) m->item().s_enum << m->type().name();
            *(m->var()) = JSmoke::Global::QtEnum.call(QScriptValue(), args);
            break;
        }
        default:
            m->unsupported();
            break;
        }
        break;
        
    case Smoke::t_class:
        switch(m->action()) {
        case Marshall::FromQScriptValue:
        {
            QScriptValue value = *(m->var());

            if (value.isNull()) {
                m->item().s_class = 0;
                return;
            }
            
            if (value.isDate()) {
                Smoke::ModuleIndex classId = Smoke::findClass(m->smoke()->classes[m->type().classId()].className);
                if (classId == JSmoke::Global::QDateClassId) {
                    m->item().s_class = new QDate(value.toDateTime().date());
                } else if (classId == JSmoke::Global::QDateTimeClassId) {
                     m->item().s_class = new QDateTime(value.toDateTime());
                } else if (classId == JSmoke::Global::QTimeClassId) {
                     m->item().s_class = new QTime(value.toDateTime().time());
                } else {
                    m->item().s_class = 0;
                }
                
                return;
            } else if (value.isRegExp()) {
                m->item().s_class = new QRegExp(value.toRegExp());
                return;
            }
            
            if (!Object::Instance::isSmokeObject(value)) {
                m->item().s_class = 0;
                return;
            }
            
            Object::Instance * instance = Object::Instance::get(value);
            void * ptr = instance->value;
            
            if (!m->cleanup() && m->type().isStack()) {
                ptr = constructCopy(instance);
            }
            
            ptr = instance->classId.smoke->cast(    ptr, 
                                                    instance->classId, 
                                                    Smoke::ModuleIndex(m->smoke(), m->type().classId()) );
            
开发者ID:KDE,项目名称:jsmoke,代码行数:66,代码来源:handlers.cpp

示例13: globals

	void Log::flush(std::ostringstream* out, const CallSite& site)
	{
		LogLock lock;
		if (!lock.ok())
		{
			return;
		}
		
		std::string message = out->str();

		{
			AIAccess<Globals> globals(Globals::get());
			if (out == &globals->messageStream)
			{
				globals->messageStream.clear();
				globals->messageStream.str("");
				globals->messageStreamInUse = false;
			}
			else
			{
				delete out;
			}
		}

		AIAccess<Settings> settings_w(Settings::get());

		if (site.mLevel == LEVEL_ERROR)
		{
			std::ostringstream fatalMessage;
			fatalMessage << abbreviateFile(site.mFile)
						<< "(" << site.mLine << ") : error";
			
			writeToRecorders(settings_w, site.mLevel, fatalMessage.str());
		}
		
		
		std::ostringstream prefix;

		switch (site.mLevel)
		{
			case LEVEL_DEBUG:		prefix << "DEBUG: ";	break;
			case LEVEL_INFO:		prefix << "INFO: ";		break;
			case LEVEL_WARN:		prefix << "WARNING: ";	break;
			case LEVEL_ERROR:		prefix << "ERROR: ";	break;
			default:				prefix << "XXX: ";		break;
		};
		
		if (settings_w->printLocation)
		{
			prefix << abbreviateFile(site.mFile)
					<< "(" << site.mLine << ") : ";
		}
		
	#if LL_WINDOWS
		// DevStudio: __FUNCTION__ already includes the full class name
	#else
		if (site.mClassInfo != typeid(NoClassInfo))
		{
			prefix << className(site.mClassInfo) << "::";
		}
	#endif
		prefix << site.mFunction << ": ";

		if (site.mPrintOnce)
		{
			std::map<std::string, unsigned int>::iterator messageIter = settings_w->uniqueLogMessages.find(message);
			if (messageIter != settings_w->uniqueLogMessages.end())
			{
				messageIter->second++;
				unsigned int num_messages = messageIter->second;
				if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0)
				{
					prefix << "ONCE (" << num_messages << "th time seen): ";
				} 
				else
				{
					return;
				}
			}
			else 
			{
				prefix << "ONCE: ";
				settings_w->uniqueLogMessages[message] = 1;
			}
		}

		if (site.mPrintOnce)
		{
			std::map<std::string, unsigned int>::iterator messageIter = settings_w->uniqueLogMessages.find(message);
			if (messageIter != settings_w->uniqueLogMessages.end())
			{
				messageIter->second++;
				unsigned int num_messages = messageIter->second;
				if (num_messages == 10 || num_messages == 50 || (num_messages % 100) == 0)
				{
					prefix << "ONCE (" << num_messages << "th time seen): ";
				} 
				else
				{
					return;
//.........这里部分代码省略.........
开发者ID:arsenico,项目名称:SingularityViewer,代码行数:101,代码来源:llerror.cpp

示例14: GAErr

GAGenome*
GAGenome::clone(CloneMethod) const
{
    GAErr(GA_LOC, className(), "clone", gaErrOpUndef);
    return new GAGenome(*this);
}
开发者ID:pemryan,项目名称:GAlib,代码行数:6,代码来源:GAGenome.C

示例15: mdlInitializeSizes

// Function: mdlInitializeSizes ===============================================
// Abstract:
//    The sizes information is used by Simulink to determine the S-function
//    block's characteristics (number of inputs, s, states, etc.).
static void mdlInitializeSizes(SimStruct *S)
{
    static char errorBuffer[512];
    if (ssGetSFcnParamsCount(S) < 1) {
        sprintf(errorBuffer, "%s", "The block type parameter must be specified");
        ssSetErrorStatus(S, errorBuffer);
        return;
    }
    char *classNameStr = mxArrayToString(ssGetSFcnParam(S, 0));
    std::string className(classNameStr);
    mxFree(classNameStr);
    wbt::Block *block = wbt::Block::instantiateBlockWithClassName(className);

    //We cannot save data in PWork during the initializeSizes phase
    ssSetNumPWork(S, 1);
    
    if (!block) {
        sprintf(errorBuffer, "Could not create an object of type %s", className.c_str());
        ssSetErrorStatus(S, errorBuffer);
        return;
    }
    
    ssSetNumSFcnParams(S, 1 + block->numberOfParameters());
    ssSetSFcnParamTunable(S, 0, false);
    for (unsigned i = 1; i < ssGetNumSFcnParams(S); ++i) {
        bool tunable = false;
        block->parameterAtIndexIsTunable(i - 1, tunable);
        ssSetSFcnParamTunable(S, i, tunable);

    }
    
    
#if defined(MATLAB_MEX_FILE)
    if(ssGetNumSFcnParams(S) == ssGetSFcnParamsCount(S)){
        mdlCheckParameters(S);
        if(ssGetErrorStatus(S)){
            return;
        }
    } else{
        sprintf(errorBuffer, "%s", "Number of parameters different from those defined");
        ssSetErrorStatus(S, errorBuffer);
        return;
    }
#endif

    wbt::Error error;
    if (!block->configureSizeAndPorts(S, &error)) {
        sprintf(errorBuffer, "%s", error.message.substr(0, 511).c_str());
        ssSetErrorStatus(S, errorBuffer);
        return;
    }

    ssSetNumSampleTimes(S, 1);

    ssSetSimStateCompliance(S, USE_CUSTOM_SIM_STATE); //??

    ssSetNumDiscStates(S, block->numberOfDiscreteStates());
    ssSetNumContStates(S, 0);//block->numberOfContinuousStates());

    uint_T options =
    SS_OPTION_WORKS_WITH_CODE_REUSE |
    SS_OPTION_EXCEPTION_FREE_CODE |
    SS_OPTION_ALLOW_INPUT_SCALAR_EXPANSION |
    SS_OPTION_USE_TLC_WITH_ACCELERATOR |
    SS_OPTION_CALL_TERMINATE_ON_EXIT;
    //also ?
    //SS_OPTION_RUNTIME_EXCEPTION_FREE_CODE

    options |= block->additionalBlockOptions();

    ssSetOptions(S, options);

    delete block;

}
开发者ID:robotology,项目名称:WB-Toolbox,代码行数:79,代码来源:toolbox.cpp


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