211 lines
5.9 KiB
C++
211 lines
5.9 KiB
C++
|
|
/*
|
||
|
|
** CPQDIF_R_Container class. Implements a PQDIF record "wrapper" for the
|
||
|
|
** data source record. You can cast a standard record object to this class.
|
||
|
|
** --------------------------------------------------------------------------
|
||
|
|
**
|
||
|
|
** File name: $Workfile: rec_container.cpp $
|
||
|
|
** Last modified: $Modtime: 7/07/99 8:11p $
|
||
|
|
** Last modified by: $Author: Erich $
|
||
|
|
**
|
||
|
|
** VCS archive path: $Archive: /PQDIF/PQDcom/PQDcom4/pqdiflib/rec_container.cpp $
|
||
|
|
** VCS revision: $Revision: 2 $
|
||
|
|
*/
|
||
|
|
#include "PQDIF_classes.h"
|
||
|
|
|
||
|
|
|
||
|
|
// Operations
|
||
|
|
|
||
|
|
bool CPQDIF_R_Container::GetCompressionInfo
|
||
|
|
(
|
||
|
|
UINT4& styleComp, // Compression style (output)
|
||
|
|
UINT4& algComp // Compression algorithm (output)
|
||
|
|
)
|
||
|
|
{
|
||
|
|
bool status = false;
|
||
|
|
GUID tagRecord;
|
||
|
|
PQDIFValue value;
|
||
|
|
|
||
|
|
// Verify that the record has the right header tag
|
||
|
|
status = HeaderGetTag( tagRecord );
|
||
|
|
if( status && PQDIF_IsEqualGUID( tagRecord, tagContainer) && m_pcollMain )
|
||
|
|
{
|
||
|
|
// It's the right type of record.
|
||
|
|
//
|
||
|
|
status = GetScalarValueInCollection( m_pcollMain,
|
||
|
|
tagCompressionStyleID, ID_PHYS_TYPE_UNS_INTEGER4, value );
|
||
|
|
|
||
|
|
if( status )
|
||
|
|
{
|
||
|
|
// We got compression style.
|
||
|
|
styleComp = value.uint4;
|
||
|
|
|
||
|
|
// Now try to get compression algorithm
|
||
|
|
status = GetScalarValueInCollection( m_pcollMain,
|
||
|
|
tagCompressionAlgorithmID, ID_PHYS_TYPE_UNS_INTEGER4, value );
|
||
|
|
if( status )
|
||
|
|
{
|
||
|
|
// We got compression algorithm. All done.
|
||
|
|
algComp = value.uint4;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return status;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
bool CPQDIF_R_Container::SetInfo
|
||
|
|
(
|
||
|
|
const char * language,
|
||
|
|
const char * title,
|
||
|
|
const char * subject,
|
||
|
|
const char * author,
|
||
|
|
const char * keywords,
|
||
|
|
const char * comments,
|
||
|
|
const char * lastSavedBy,
|
||
|
|
const char * application,
|
||
|
|
const char * security,
|
||
|
|
const char * owner,
|
||
|
|
const char * copyright,
|
||
|
|
const char * trademarks,
|
||
|
|
const char * notes
|
||
|
|
)
|
||
|
|
{
|
||
|
|
bool rc = false;
|
||
|
|
|
||
|
|
if( m_pcollMain )
|
||
|
|
{
|
||
|
|
// Add string entries
|
||
|
|
m_pcollMain->SetVectorString( tagLanguage, language );
|
||
|
|
m_pcollMain->SetVectorString( tagTitle, title );
|
||
|
|
m_pcollMain->SetVectorString( tagSubject, subject );
|
||
|
|
m_pcollMain->SetVectorString( tagAuthor, author );
|
||
|
|
m_pcollMain->SetVectorString( tagKeywords, keywords );
|
||
|
|
m_pcollMain->SetVectorString( tagComments, comments );
|
||
|
|
m_pcollMain->SetVectorString( tagLastSavedBy, lastSavedBy );
|
||
|
|
m_pcollMain->SetVectorString( tagApplication, application );
|
||
|
|
m_pcollMain->SetVectorString( tagSecurity, security );
|
||
|
|
|
||
|
|
m_pcollMain->SetVectorString( tagOwner, owner );
|
||
|
|
m_pcollMain->SetVectorString( tagCopyright, copyright );
|
||
|
|
m_pcollMain->SetVectorString( tagTrademarks, trademarks );
|
||
|
|
|
||
|
|
m_pcollMain->SetVectorString( tagNotes, notes );
|
||
|
|
|
||
|
|
|
||
|
|
rc = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
return rc;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
bool CPQDIF_R_Container::SetInfo1
|
||
|
|
(
|
||
|
|
const char * language,
|
||
|
|
const char * title,
|
||
|
|
const char * subject,
|
||
|
|
const char * author,
|
||
|
|
const char * keywords,
|
||
|
|
const char * comments,
|
||
|
|
const char * lastSavedBy,
|
||
|
|
const char * application,
|
||
|
|
const char * security,
|
||
|
|
const char * owner,
|
||
|
|
const char * copyright,
|
||
|
|
const char * trademarks,
|
||
|
|
const char * notes,
|
||
|
|
const char * ApplicationVersion,
|
||
|
|
const char * SystemName,
|
||
|
|
const char * SystemVersion
|
||
|
|
)
|
||
|
|
{
|
||
|
|
bool rc = false;
|
||
|
|
|
||
|
|
if( m_pcollMain )
|
||
|
|
{
|
||
|
|
// Add string entries
|
||
|
|
m_pcollMain->SetVectorString( tagLanguage, language );
|
||
|
|
m_pcollMain->SetVectorString( tagTitle, title );
|
||
|
|
m_pcollMain->SetVectorString( tagSubject, subject );
|
||
|
|
m_pcollMain->SetVectorString( tagAuthor, author );
|
||
|
|
m_pcollMain->SetVectorString( tagKeywords, keywords );
|
||
|
|
m_pcollMain->SetVectorString( tagComments, comments );
|
||
|
|
m_pcollMain->SetVectorString( tagLastSavedBy, lastSavedBy );
|
||
|
|
m_pcollMain->SetVectorString( tagApplication, application );
|
||
|
|
m_pcollMain->SetVectorString( tagSecurity, security );
|
||
|
|
|
||
|
|
m_pcollMain->SetVectorString( tagOwner, owner );
|
||
|
|
m_pcollMain->SetVectorString( tagCopyright, copyright );
|
||
|
|
m_pcollMain->SetVectorString( tagTrademarks, trademarks );
|
||
|
|
|
||
|
|
m_pcollMain->SetVectorString( tagNotes, notes );
|
||
|
|
|
||
|
|
m_pcollMain->SetVectorString( tagApplicationVersion, ApplicationVersion );
|
||
|
|
m_pcollMain->SetVectorString( tagSystemName, SystemName );
|
||
|
|
m_pcollMain->SetVectorString( tagSystemVersion, SystemVersion );
|
||
|
|
rc = true;
|
||
|
|
}
|
||
|
|
|
||
|
|
return rc;
|
||
|
|
}
|
||
|
|
|
||
|
|
bool CPQDIF_R_Container::GetTagFileName(string& strFileName)
|
||
|
|
{
|
||
|
|
bool status = FALSE;
|
||
|
|
|
||
|
|
CPQDIF_E_Collection * pcollMain = m_pcollMain;
|
||
|
|
CPQDIF_E_Vector * pvect;
|
||
|
|
|
||
|
|
if( pcollMain )
|
||
|
|
{
|
||
|
|
// Find strings
|
||
|
|
pvect = FindVectorInCollection( pcollMain, tagFileName );
|
||
|
|
if( pvect ) pvect->GetValues( strFileName );
|
||
|
|
|
||
|
|
status = TRUE;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
return status;
|
||
|
|
}
|
||
|
|
|
||
|
|
bool CPQDIF_R_Container::SetTimeCreationAndTimeLastSaved
|
||
|
|
(
|
||
|
|
const TIMESTAMPPQDIF& timeCreation,
|
||
|
|
const TIMESTAMPPQDIF& timeLastSaved
|
||
|
|
)
|
||
|
|
{
|
||
|
|
bool status = false;
|
||
|
|
|
||
|
|
CPQDIF_E_Scalar * psc;
|
||
|
|
CPQDIF_E_Vector * pvect;
|
||
|
|
|
||
|
|
// Init
|
||
|
|
if (m_pcollMain == NULL)
|
||
|
|
return false;
|
||
|
|
|
||
|
|
// First, find (or create) the trigger method
|
||
|
|
psc = FindOrCreateScalarInCollection(m_pcollMain,
|
||
|
|
tagCreation, ID_PHYS_TYPE_TIMESTAMPPQDIF);
|
||
|
|
// Set its value
|
||
|
|
if (psc)
|
||
|
|
{
|
||
|
|
status = psc->SetValueTimeStamp(timeCreation);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Set the time it was triggered
|
||
|
|
if (status)
|
||
|
|
{
|
||
|
|
status = false;
|
||
|
|
psc = FindOrCreateScalarInCollection(m_pcollMain,
|
||
|
|
tagLastSaved, ID_PHYS_TYPE_TIMESTAMPPQDIF);
|
||
|
|
// Set value
|
||
|
|
if (psc)
|
||
|
|
{
|
||
|
|
status = psc->SetValueTimeStamp(timeLastSaved);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return status;
|
||
|
|
}
|