Esempio n. 1
0
/********************************************************************************************

>	TemplateAttribute::TemplateAttribute(	const StringBase& InternalName,
											const StringBase& Question,
											const StringBase& Param)
 	Author:		Colin_Barfoot (Xara Group Ltd) <*****@*****.**>
	Created:	27/06/97

	Purpose:	Default constructor for TemplateAttribute

	Inputs:		InternalName 
				Question
				Param

	Notes:		Currently forms a UserAttribute with a LongKey of
				WizOp\InternalName/Param

********************************************************************************************/
TemplateAttribute::TemplateAttribute(	const StringBase& InternalName,
										const StringBase& Question,
										const StringBase& Param)
{
	// Copy as much of the question as we can.
	SetWizOpNameAndParam(InternalName, Param);

	// Cache this test for faster Attribute gallery scans.
	m_fIsAnObjectName = (GetInternalName() == TA_NAME);

	if (Question.Length() > 0)
	{
		String_256 NewValue;
		INT32 LengthToCopy = (NewValue.MaxLength() < Question.Length())
								? TRACE( _T("TemplateAttribute::TemplateAttribute: Q truncated\n")),
								  NewValue.MaxLength()
								: Question.Length();
		if (LengthToCopy > 0)
		{
			String_256 TruncatedQuestion;
			Question.Left(&TruncatedQuestion, LengthToCopy);

			if (!Value.Value.Alloc(TruncatedQuestion.Length()))
			{
				ERROR1RAW(_R(IDE_NOMORE_MEMORY));
				return;
			}

			Value.Value = TruncatedQuestion;
		}
	}
}
Esempio n. 2
0
/********************************************************************************************

>	String_256 TemplateAttribute::GetQuestion() const

	Author:		Colin_Barfoot (Xara Group Ltd) <*****@*****.**>
	Created:	09/06/97
	
	Purpose:	Retrieves the Question of this TemplateAttribute

********************************************************************************************/
String_256 TemplateAttribute::GetQuestion() const
{
	String_256 Question;
	const StringBase& SourceString = Value.Value;

	UINT32 LengthToCopy = SourceString.Length() > Question.MaxLength() ? 
								Question.MaxLength() : 
								SourceString.Length();

	SourceString.Left(&Question, LengthToCopy);
	return Question;
}