void WriterImplBase::RegisterPackageVersion(PackageAttributeList& attributeList, const BPackageVersion& version, BHPKGAttributeID attributeID) { PackageAttribute* versionMajor = AddStringAttribute(attributeID, version.Major(), attributeList); if (!version.Minor().IsEmpty()) { AddStringAttribute(B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR, version.Minor(), versionMajor->children); _AddStringAttributeIfNotEmpty( B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO, version.Micro(), versionMajor->children); } _AddStringAttributeIfNotEmpty( B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_PRE_RELEASE, version.PreRelease(), versionMajor->children); if (version.Revision() != 0) { PackageAttribute* versionRevision = new PackageAttribute( B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION, B_HPKG_ATTRIBUTE_TYPE_UINT, B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT); versionRevision->unsignedInt = version.Revision(); versionMajor->children.Add(versionRevision); } }
void WriterImplBase::RegisterPackageVersion(PackageAttributeList& attributeList, const BPackageVersion& version) { PackageAttribute* versionMajor = new PackageAttribute( B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR, B_HPKG_ATTRIBUTE_TYPE_STRING, B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE); versionMajor->string = fPackageStringCache.Get(version.Major().String()); attributeList.Add(versionMajor); if (version.Minor().Length() > 0) { PackageAttribute* versionMinor = new PackageAttribute( B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR, B_HPKG_ATTRIBUTE_TYPE_STRING, B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE); versionMinor->string = fPackageStringCache.Get(version.Minor().String()); versionMajor->children.Add(versionMinor); if (version.Micro().Length() > 0) { PackageAttribute* versionMicro = new PackageAttribute( B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO, B_HPKG_ATTRIBUTE_TYPE_STRING, B_HPKG_ATTRIBUTE_ENCODING_STRING_TABLE); versionMicro->string = fPackageStringCache.Get(version.Micro().String()); versionMajor->children.Add(versionMicro); } } if (version.Release() != 0) { PackageAttribute* versionRelease = new PackageAttribute( B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_RELEASE, B_HPKG_ATTRIBUTE_TYPE_UINT, B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT); versionRelease->unsignedInt = version.Release(); versionMajor->children.Add(versionRelease); } }