1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
4 #include "ValidatorArchive.h"
6 #include <CrySchematyc2/Serialization/ISerializationContext.h>
7 #include <CrySchematyc2/Services/ILog.h>
11 CValidatorArchive::CValidatorArchive(const SValidatorArchiveParams
& params
)
12 : IValidatorArchive(Serialization::IArchive::OUTPUT
| Serialization::IArchive::INPLACE
| Serialization::IArchive::VALIDATION
)
13 , m_flags(params
.flags
)
18 bool CValidatorArchive::operator () (bool& value
, const char* szName
, const char* szLabel
)
23 bool CValidatorArchive::operator () (int8
& value
, const char* szName
, const char* szLabel
)
28 bool CValidatorArchive::operator () (uint8
& value
, const char* szName
, const char* szLabel
)
33 bool CValidatorArchive::operator () (int32
& value
, const char* szName
, const char* szLabel
)
38 bool CValidatorArchive::operator () (uint32
& value
, const char* szName
, const char* szLabel
)
43 bool CValidatorArchive::operator () (int64
& value
, const char* szName
, const char* szLabel
)
48 bool CValidatorArchive::operator () (uint64
& value
, const char* szName
, const char* szLabel
)
53 bool CValidatorArchive::operator () (float& value
, const char* szName
, const char* szLabel
)
58 bool CValidatorArchive::operator () (Serialization::IString
& value
, const char* szName
, const char* szLabel
)
63 bool CValidatorArchive::operator () (const Serialization::SStruct
& value
, const char* szName
, const char* szLabel
)
69 bool CValidatorArchive::operator() (Serialization::IContainer
& value
, const char* szName
, const char* szLabel
)
75 value(*this, szName
, szLabel
);
76 } while(value
.next());
81 uint32
CValidatorArchive::GetWarningCount() const
83 return m_warningCount
;
86 uint32
CValidatorArchive::GetErrorCount() const
91 void CValidatorArchive::validatorMessage(bool bError
, const void* handle
, const Serialization::TypeID
& type
, const char* szMessage
)
95 if((m_flags
& EValidatorArchiveFlags::ForwardErrorsToLog
) != 0)
97 SValidatorLink validatorLink
;
98 if(SerializationContext::GetValidatorLink(*this, validatorLink
))
100 const CLogMessageMetaInfo
metaInfo(ECryLinkCommand::Show
, SLogMetaItemGUID(validatorLink
.itemGUID
), SLogMetaChildGUID(validatorLink
.detailGUID
));
101 SCHEMATYC2_SYSTEM_METAINFO_ERROR(metaInfo
, szMessage
);
105 SCHEMATYC2_SYSTEM_ERROR(szMessage
);
112 if((m_flags
& EValidatorArchiveFlags::ForwardWarningsToLog
) != 0)
114 SValidatorLink validatorLink
;
115 if(SerializationContext::GetValidatorLink(*this, validatorLink
))
117 const CLogMessageMetaInfo
metaInfo(ECryLinkCommand::Show
, SLogMetaItemGUID(validatorLink
.itemGUID
), SLogMetaChildGUID(validatorLink
.detailGUID
));
118 SCHEMATYC2_SYSTEM_METAINFO_WARNING(metaInfo
, szMessage
);
122 SCHEMATYC2_SYSTEM_WARNING(szMessage
);