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


C++ Artifact类代码示例

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


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

示例1: GetArtifactByWorkshareId

void FacadeDocumentProviderImpl::GetDocument(const std::wstring& id, long flags, WSDocNonCom& wsDoc)
{	     
	Artifact document = GetArtifactByWorkshareId(id);

	if(!(flags & DF_INFO_ONLY))
	{
		document.Download();
		wsDoc.SetLocalFile(document.WorkingFileName);
	}

	if(flags & DF_LOCK)
	{
		// TODO: Artifact.Lock() should return a value wether lock was successful,
		// it might have already been locked by other user.
		document.Lock();
		wsDoc.SetFlags(DOCUMENT_LOCKED_BY_US);
	}
	else
	{
		// If not require locking, set this flag accordingly
		wsDoc.SetFlags(DOCUMENT_NOT_LOCKED);
	}

	PopulateWSDocMembersFromArtifact(document, wsDoc);
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:25,代码来源:FacadeDocumentProviderImpl.cpp

示例2: CreateMockArtifacts

void TestComArtifacts::TestGetAt()
{
	extern bool g_bCalledArtifacts_GetItem;
	_ArtifactsPtr spArtifacts = CreateMockArtifacts(_T("mock://123/123"));  
	ComArtifacts artifacts(spArtifacts);
	Artifact bridge = artifacts.GetAt(0);
	assertTypeOf(bridge.GetImplementor(), const ComArtifact*);   
	assertMessage(g_bCalledArtifacts_GetItem, _T("Expected ComArtifacts::GetAt to call _Artifacts::get_Item"));
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:9,代码来源:TestComArtifacts.cpp

示例3: switch

void GameOver::DialogWins(u16 cond)
{
    const Settings & conf = Settings::Get();
    std::string body;

    switch(cond)
    {
	case WINS_ALL:
	    break;

	case WINS_TOWN:
	{
	    body = _("You captured %{name}!\nYou are victorious.");
	    const Castle* town = world.GetCastle(conf.WinsMapsIndexObject());
	    if(town) String::Replace(body, "%{name}", town->GetName());
	}
	break;

	case WINS_HERO:
	{
	    body = _("You have captured the enemy hero %{name}!\nYour quest is complete.");
	    const Heroes* hero = world.GetHeroesCondWins();
	    if(hero) String::Replace(body, "%{name}", hero->GetName());
	    break;
	}

	case WINS_ARTIFACT:
	{
	    body = _("You have found the %{name}.\nYour quest is complete.");
	    if(conf.WinsFindUltimateArtifact())
		String::Replace(body, "%{name}", "Ultimate Artifact");
	    else
	    {
		const Artifact art = conf.WinsFindArtifactID();
		String::Replace(body, "%{name}", art.GetName());
	    }
	    break;
        }

        case WINS_SIDE:
    	    body = _("The enemy is beaten.\nYour side has triumphed!");
    	    break;

        case WINS_GOLD:
        {
    	    body = _("You have built up over %{count} gold in your treasury.\nAll enemies bow before your wealth and power.");
	    String::Replace(body, "%{count}", conf.WinsAccumulateGold());
    	    break;
	}

    	default: break;
    }

    AGG::PlayMusic(MUS::VICTORY, false);

    if(body.size()) Dialog::Message("", body, Font::BIG, Dialog::OK);
}
开发者ID:infsega,项目名称:fheroes2-playbook,代码行数:57,代码来源:game_over.cpp

示例4: CreateMockArtifact

void TestComArtifact::TestCreateRelatedItem()
{
    extern bool g_bCalledArtifact_CreateRelatedItem;

    _ArtifactPtr spArtifact = CreateMockArtifact(L"mock://123/123");
    ComArtifact artifact(spArtifact);
    Artifact bridge = artifact.CreateRelatedItem(L"", L"", L"", false);

    assertTypeOf(bridge.GetImplementor(), const ComArtifact*);
    assertMessage(g_bCalledArtifact_CreateRelatedItem, _T("Expected MockArtifact::CreateRelatedArtifact to be called from ComArtifact::CreateRelatedArtifact"));
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:11,代码来源:TestComArtifact.cpp

示例5: testDominoDocument

void TestDominoDocArtifact::TestCreateNewVersion()
{
	DomDocHelper testDominoDocument(TEST_ARTIFACT_FILE);
	DominoDocArtifact artifact(m_spLibrary, testDominoDocument.DocumentId, testDominoDocument.GetVersionLabel());
	long originalVersionCount = artifact.GetVersions().Count;
	std::wstring originalVersion = artifact.VersionLabel;

	Artifact newVersion = artifact.CreateNewVersion(L"This version was created by TestDominoDocArtifact::TestCreateNewVersion().", L"formats");
	assertMessage(!newVersion.IsNull(), _T("Expect a non-null artifact representing the new version."));
	assertMessage((originalVersionCount + 1) == artifact.GetVersions().Count, _T("Creating a new version should increase the version count by one."));
	assertMessage(0 != newVersion.VersionLabel.compare(originalVersion), _T("The new artifact has the same version label as the original artifact."));
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:12,代码来源:TestDominoDocArtifact.cpp

示例6: translateInOutputs

void Transformer::setupInputs(QScriptValue targetScriptValue, const ArtifactSet &inputs,
        const QString &defaultModuleName)
{
    const auto scriptEngine = static_cast<ScriptEngine *>(targetScriptValue.engine());
    QScriptValue scriptValue = translateInOutputs(scriptEngine, inputs, defaultModuleName);
    targetScriptValue.setProperty(StringConstants::inputsVar(), scriptValue);
    QScriptValue inputScriptValue;
    if (inputs.size() == 1) {
        Artifact *input = *inputs.cbegin();
        const FileTags &fileTags = input->fileTags();
        QBS_ASSERT(!fileTags.empty(), return);
        QScriptValue inputsForFileTag = scriptValue.property(fileTags.cbegin()->toString());
        inputScriptValue = inputsForFileTag.property(0);
    }
开发者ID:qt-labs,项目名称:qbs,代码行数:14,代码来源:transformer.cpp

示例7: GetConnector

std::wstring FacadeDocumentProviderImpl::TranslateOdmaID(const std::wstring& id)
{
	std::wstring repositoryId, artifactId, artifactVersionLabel;
	bool supports = GetConnector().GetInfoFromOdmaId(id, repositoryId, artifactId, artifactVersionLabel);     
	if(supports)
	{
		// TODO: We do the following to ensure that we always have a fully qualified workshare id.
		// Some connectors may not include the version label for the most current document in the ODMA id
		Artifact artifact = GetConnector().GetRepositoryById(repositoryId).GetArtifactById(artifactId, artifactVersionLabel);
		return EncodeWorkshareId(artifact.Id, artifact.VersionLabel, artifact.GetRepository().Id);
	}
	else
		return L"";

}
开发者ID:killbug2004,项目名称:WSProf,代码行数:15,代码来源:FacadeDocumentProviderImpl.cpp

示例8: RemoveScroll

void BagArtifacts::RemoveScroll(const Artifact & art)
{
    Spell spell(art.GetSpell());
    if(spell.isValid())
    {
	iterator it = std::find(begin(), end(), spell);
	if(it != end()) (*it).Reset();
    }
}
开发者ID:asimonov-im,项目名称:fheroes2,代码行数:9,代码来源:artifact.cpp

示例9: LOG_WS_FUNCTION_SCOPE

bool FacadeDocumentProviderImpl::SelectDocumentEx(LONG_PTR lHwnd, const std::wstring& formatString, const std::wstring& /*previousSelectedDocumentId*/, std::wstring& documentId)
{
	// TODO: We need a SelectArtifactVersion if previousSelectedDocumentId has something.
	LOG_WS_FUNCTION_SCOPE();

	Connector& connector = GetConnector();
	LOG_WS_INFO(L"Retrieved connector" );
	
	Artifact document = connector.SelectArtifact((HWND)lHwnd, formatString);
	if(document.IsNull())
	{
		LOG_WS_INFO(L"document == NULL" );
		return false;
	}

	documentId = EncodeWorkshareId(document.Id, document.VersionLabel, document.GetRepository().Id);	
	return true;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:18,代码来源:FacadeDocumentProviderImpl.cpp

示例10: _T

void FacadeDocumentProviderImpl::PopulateWSDocMembersFromArtifact(Artifact artifact, WSDocNonCom& wsdoc)
{   
	std::tostringstream msg;
	msg << _T("The following artifact will be returned to Workshare:") << std::endl;
	msg << _T("Name:") << artifact.Name << std::endl;
	std::wstring id = EncodeWorkshareId(artifact.Id, artifact.VersionLabel, artifact.GetRepository().Id);
	msg << _T("Artifact Id:") << artifact.Id << std::endl;
	msg << _T("Artifact Version Label:") << artifact.VersionLabel << std::endl;
	msg << _T("Repository Id:") << artifact.GetRepository().Id << std::endl;
	msg << _T("Workshare Id:") << id << std::endl;
	msg << _T("Extension:") << artifact.FileExtension << std::endl;

	wsdoc.SetDescription(artifact.Name);
	wsdoc.SetDocId(id);
	wsdoc.SetExtension(artifact.FileExtension.c_str());
	CStdString sWorkingFile;
	try
	{
		sWorkingFile = artifact.WorkingFileName;
	}
	catch(...)
	{
		//dont worry if there is no working file just continue
	}
	if(sWorkingFile.IsEmpty())
	{
		wsdoc.SetModifiedTime(0);
		wsdoc.SetFileSizeLow(0);
		wsdoc.SetFileSizeHigh(0);
		msg << _T("Working File Name: <none>") << std::endl;
	}
	else
	{
		wsdoc.SetLocalFile(artifact.WorkingFileName);
		wsdoc.SetModifiedTime((DATE)artifact.ModifiedTime);
		wsdoc.SetFileSizeLow(artifact.FileSize);
		wsdoc.SetFileSizeHigh(0);
		msg << _T("Working File Name: ") << artifact.WorkingFileName << std::endl;
		msg << _T("File Size: ") << artifact.FileSize << std::endl;
		msg << _T("Modified Time: ") << artifact.ModifiedTime << std::endl;
	}
	msg << std::ends;
	LOG_WS_INFO(msg.str().c_str());
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:44,代码来源:FacadeDocumentProviderImpl.cpp

示例11: Set

void UltimateArtifact::Set(s32 pos, const Artifact & a)
{
    Artifact & art = *this;
    art = a.isValid() ? a : Artifact::Rand(Artifact::ART_ULTIMATE);
    index = pos;
    isfound = false;

    if(Maps::isValidAbsIndex(index))
	Interface::GameArea::GenerateUltimateArtifactAreaSurface(index, puzzlemap);
    else
	Surface::FreeSurface(puzzlemap);
}
开发者ID:asimonov-im,项目名称:fheroes2,代码行数:12,代码来源:artifact_ultimate.cpp

示例12: CanTranscribeScroll

bool HeroBase::CanTranscribeScroll(const Artifact & art) const
{
    Spell spell = art.GetSpell();

    if(spell.isValid() && CanCastSpell(spell))
    {
	int learning = GetLevelSkill(Skill::Secondary::LEARNING);

	return ((3 <  spell.Level() && Skill::Level::EXPERT == learning) ||
	    (3 == spell.Level() && Skill::Level::ADVANCED <= learning) ||
	    (3 > spell.Level() && Skill::Level::BASIC <= learning));
    }

    return false;
}
开发者ID:mastermind-,项目名称:free-heroes,代码行数:15,代码来源:heroes_base.cpp

示例13: switch

u32 HeroBase::HasArtifact(const Artifact & art) const
{
    bool unique = true;

    switch(art.Type())
    {
	case 1:	unique = Settings::Get().ExtWorldUseUniqueArtifactsML(); break; /* morale/luck arts. */
	case 2:	unique = Settings::Get().ExtWorldUseUniqueArtifactsRS(); break; /* resource affecting arts. */
	case 3:	unique = Settings::Get().ExtWorldUseUniqueArtifactsPS(); break; /* primary/mp/sp arts. */
	case 4:	unique = Settings::Get().ExtWorldUseUniqueArtifactsSS(); break; /* sec. skills arts. */
	default: break;
    }

    return ! unique ? bag_artifacts.Count(art) :
        (bag_artifacts.isPresentArtifact(art) ? 1 : 0);
}
开发者ID:mastermind-,项目名称:free-heroes,代码行数:16,代码来源:heroes_base.cpp

示例14: TranscribeScroll

void HeroBase::TranscribeScroll(const Artifact & art)
{
    Spell spell = art.GetSpell();

    if(spell.isValid())
    {
	// add spell
	spell_book.Append(spell);

	// remove art
	bag_artifacts.RemoveScroll(art);

	// reduce mp and resource
	SpellCasted(spell);
    }
}
开发者ID:mastermind-,项目名称:free-heroes,代码行数:16,代码来源:heroes_base.cpp

示例15: UNREFERENCED_PARAMETER

HRESULT FacadeDocumentProviderImpl::GetSaveInfo(HWND hWnd, const std::wstring& formatString, long lFlags, long& lFormatIndex, WSDocNonCom& wsDoc)
{
	//-- ArtifactImpl
	//TODO: Replace Existing Version
	//TODO: Create a relation

	//-- Connector
	// Create new artifact (Add Files)
	UNREFERENCED_PARAMETER(lFormatIndex);
	if(DF_NEW_DOCUMENT & lFlags)
	{
		std::wstring newFileName = wsDoc.GetDescription();
		Artifact artifact = GetConnector().CreateArtifact(hWnd, formatString, newFileName);
		if (artifact.IsNull())
			return E_DOCUMENT_NOT_FOUND;
		PopulateWSDocMembersFromArtifact(artifact, wsDoc);
		wsDoc.SetFlags(DOCUMENT_LOCKED_BY_US);
		lFormatIndex = CalculateFormatIndex(formatString, artifact.GetFileExtension());
		artifact.Lock();
	}
	// Create a relation
	else if(DF_ATTACH & lFlags)
	{
		Artifact existing = GetArtifactByWorkshareId(wsDoc.GetDocId());	

		if (existing.IsNull())
			return E_DOCUMENT_NOT_FOUND;

		CStdString sDummyFile = CTempFileManager::GetTempFileName();;
		CStdString sExt; 
		DocUtilities::GetExtensionFromFileName(sDummyFile,sExt);

		Artifact related = existing.CreateRelatedItem(CStdStringW(sDummyFile),GetDefaultSaveExtensionFromFormatString(formatString, lFormatIndex), formatString, true);

		if (related.IsNull())
			return E_DOCUMENT_NOT_FOUND;

		related.Lock();

		PopulateWSDocMembersFromArtifact(related, wsDoc);
		lFormatIndex = CalculateFormatIndex(formatString, related.GetFileExtension());

		wsDoc.SetFlags(DOCUMENT_LOCKED_BY_US);
	}
	// Create a new version
	else if(DF_VERSION & lFlags)
	{
		std::wstring repositoryId;
		std::wstring artifactId;
		std::wstring versionLabel;
		DecodeWorkshareId(wsDoc.GetDocId().c_str(), artifactId, versionLabel, repositoryId);
		Repository repository = GetConnector().GetRepositoryById(repositoryId.c_str());
		Artifact artifact = repository.GetArtifactById(artifactId.c_str(), versionLabel.c_str());
		Artifact artifactVersion = artifact.CreateNewVersion(L"", formatString);
		PopulateWSDocMembersFromArtifact(artifactVersion, wsDoc);
		artifactVersion.Lock(); 
		wsDoc.SetFlags(DOCUMENT_LOCKED_BY_US);
		lFormatIndex = CalculateFormatIndex(formatString, artifactVersion.GetFileExtension());

	}
	return S_OK;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:62,代码来源:FacadeDocumentProviderImpl.cpp


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