コード例 #1
0
ファイル: DebugInfoEntries.cpp プロジェクト: DonCN/haiku
status_t
DIEInheritance::AddAttribute_data_member_location(uint16 attributeName,
	const AttributeValue& value)
{
	return SetMemberLocation(fLocation, value);
}
コード例 #2
0
ファイル: RTFformatting.cpp プロジェクト: killbug2004/WSProf
ERTFToken RTFformatting::ReadToken(ERTFToken Token, RTFParser* Parser)
{
	if(Token == rtfcw_nesttableprops)
		m_bNestedTblDef = true;

	if(m_fLocation == flUnknown)
	{
		m_fLocation = GetLocationFor(Token);

		if(m_fLocation != flUnknown)
		{
			SetMemberLocation();
		}
	}

	if(TerminatingToken(Token)!=flUnknown)
		return ReadTerminatingToken(Token, Parser);

	if (RTFbrdrdef::AcceptsToken(Token, m_fLocation))
	{
		//if (Parser->GetDestinationType()==rotTbldef) return rtfrc_NotMatched;
		// The following test should be taken care of in RTFbrdrdef::AcceptsToken(ERTFToken Token, FormattingLocation fLocation)
		// See the comment there
		if (Parser->GetDestinationType()==rotListlevel) return rtfrc_NotMatched;

		if (!the_RTFbrdrdef)
		{
			the_RTFbrdrdef = (RTFbrdrdef*) new RTFbrdrdef(m_pContext);
			THROW_IF_FAILED_TO_ALLOCATE_MEMORY(the_RTFbrdrdef, _T("Failed to allocate RTFbrdrdef"));

			GetBrdrDefToModify()->SetLocation(m_fLocation);
		}

		return GetBrdrDefToModify()->ReadToken(Token, Parser);
	}
	if (RTFapoctl::AcceptsToken(Token))
	{
		if (!the_RTFapoctl)
		{
			the_RTFapoctl = (RTFapoctl*) new RTFapoctl(m_pContext);
			THROW_IF_FAILED_TO_ALLOCATE_MEMORY(the_RTFapoctl, _T("Failed to allocate RTFapoctl"));

			the_RTFapoctl->SetLocation(m_fLocation);
		}

		return the_RTFapoctl->ReadToken(Token, Parser);
	}
	if (RTFtapoctl::AcceptsToken(Token))
	{
		if (!the_RTFtapoctl)
		{
			the_RTFtapoctl = (RTFtapoctl*) new RTFtapoctl(m_pContext);
			THROW_IF_FAILED_TO_ALLOCATE_MEMORY(the_RTFtapoctl, _T("Failed to allocate RTFtapoctl"));

			the_RTFtapoctl->SetLocation(m_fLocation);
		}

		return the_RTFtapoctl->ReadToken(Token, Parser);
	}
	if (RTFshading::AcceptsToken(Token))
	{
		bool bLocationIsAppropriate = true;
		if (!InHeader())	// ie document -> accept para shading only.
		{
			bLocationIsAppropriate = (m_fLocation == flCell) || (m_fLocation == flPara) || (m_fLocation == flUnknown); //RTFshading::GetShadingType(Token) == shadePara;
		}

		if (bLocationIsAppropriate)
		{
			if (!the_RTFshading)
			{
				the_RTFshading = (RTFshading*) new RTFshading(m_pContext);
				THROW_IF_FAILED_TO_ALLOCATE_MEMORY(the_RTFshading, _T("Failed to allocate RTFshading"));

				the_RTFshading->SetLocation(m_fLocation);
			}

			return the_RTFshading->ReadToken(Token, Parser);
		}
	}
	if (RTFtabdef::AcceptsToken(Token))
	{
		if (!the_RTFtabdef)
		{
			the_RTFtabdef = (RTFtabdef*) new RTFtabdef(m_pContext);
			THROW_IF_FAILED_TO_ALLOCATE_MEMORY(the_RTFtabdef, _T("Failed to allocate RTFtabdef"));

			the_RTFtabdef->SetLocation(m_fLocation);
		}

		return the_RTFtabdef->ReadToken(Token, Parser);
	}

	if (RTFpn::AcceptsToken(Token))
	{
		if (!the_RTFpn)
		{
			the_RTFpn = (RTFpn*) new RTFpn(m_pContext);
			THROW_IF_FAILED_TO_ALLOCATE_MEMORY(the_RTFpn, _T("Failed to allocate RTFpn"));

			the_RTFpn->SetLocation(m_fLocation);
			Parser->SetContentDestination(the_RTFpn);
		}

		return the_RTFpn->ReadToken(Token, Parser);
	}

	if (RTFpnprops::AcceptsToken(Token))
	{
		bool bContinue = true;

		if (Token == rtfcw_ls || Token== rtfcw_ilvl)
		{
			// ls && ilvl go into parfmt as well as pnprops
			// if listtext (no pntext), then just go into parfmt.
			if (!the_RTFpnprops)
			{
				bContinue = false;
			}
			else
			{
				if (Token == rtfcw_ls && the_RTFpnprops->GetLs() > -1)
					bContinue = false;
				else if (Token == rtfcw_ilvl && the_RTFpnprops->GetIlvl() > -1)
					bContinue = false;
			}
		}

		if (bContinue)
		{
			if (!the_RTFpnprops)
			{
				the_RTFpnprops = (RTFpnprops*) new RTFpnprops(m_pContext);
				THROW_IF_FAILED_TO_ALLOCATE_MEMORY(the_RTFpnprops, _T("Failed to allocate RTFpnprops"));

				the_RTFpnprops->SetLocation(m_fLocation);
			}

			return the_RTFpnprops->ReadToken(Token, Parser);
		}
	}

//	if (Token == rtfcw_pard)
//	{
//		if (the_RTFparfmt && the_RTFparfmt->IsInTable())
//			return rtfrc_NotMatched;
//	}

	if (RTFparfmt::AcceptsToken(Token, m_fLocation))
	{
		//	BobH 10-01-01 Change 1313 - Fallen out of a scope so ensure that table formatting is rejected
		// /NB This forces a new parfmt object to be created that "inherits" any tokens that came before this one
		if (bNoObjectSinceEndOfScope)
		{
			if (((Token==rtfcw_intbl) || (Token==rtfcw_itap)))
			{
				if ((!the_RTFparfmt->get_bImplicit())&&(the_RTFpn==0))
				{
					return rtfrc_NotMatched;
				}
			}
		}

		if (!the_RTFparfmt)
		{
			the_RTFparfmt = (RTFparfmt*) new RTFparfmt(m_pContext);
			THROW_IF_FAILED_TO_ALLOCATE_MEMORY(the_RTFparfmt, _T("Failed to allocate RTFparfmt"));

			GetParfmtToModify()->SetLocation(m_fLocation);
			GetParfmtToModify()->MakeImplicit();
		}

		return GetParfmtToModify()->ReadToken(Token, Parser);
	}
	if (InHeader() && RTFchrfmt::AcceptsToken(Token))
	{
		if (!the_RTFchrfmt)
		{
			the_RTFchrfmt = (RTFchrfmt*) new RTFchrfmt(m_pContext);
			THROW_IF_FAILED_TO_ALLOCATE_MEMORY(the_RTFchrfmt, _T("Failed to allocate RTFchrfmt"));

			GetChrfmtToModify()->SetLocation(m_fLocation);
			GetChrfmtToModify()->SetOptionalDefaults();
		}

		return GetChrfmtToModify()->ReadToken(Token, Parser, 0);
	}

	return rtfrc_NotMatched;
}