| 1166 | // pos3 Properties file written by implWritePropertiesFile |
| 1167 | |
| 1168 | Sequence< sal_Int8 > StringResourcePersistenceImpl::exportBinary( ) |
| 1169 | { |
| 1170 | BinaryOutput aOut; |
| 1171 | |
| 1172 | sal_Int32 nLocaleCount = m_aLocaleItemVector.size(); |
| 1173 | std::vector<Sequence< sal_Int8 >> aLocaleDataSeq(nLocaleCount); |
| 1174 | |
| 1175 | sal_Int32 iLocale = 0; |
| 1176 | sal_Int32 iDefault = 0; |
| 1177 | for( auto& pLocaleItem : m_aLocaleItemVector ) |
| 1178 | { |
| 1179 | if( pLocaleItem != nullptr && loadLocale( pLocaleItem.get() ) ) |
| 1180 | { |
| 1181 | if( m_pDefaultLocaleItem == pLocaleItem.get() ) |
| 1182 | iDefault = iLocale; |
| 1183 | |
| 1184 | BinaryOutput aLocaleOut; |
| 1185 | implWriteLocaleBinary( pLocaleItem.get(), aLocaleOut ); |
| 1186 | |
| 1187 | aLocaleDataSeq[iLocale] = aLocaleOut.closeAndGetData(); |
| 1188 | } |
| 1189 | ++iLocale; |
| 1190 | } |
| 1191 | |
| 1192 | // Write header |
| 1193 | sal_Int16 nLocaleCount16 = static_cast<sal_Int16>(nLocaleCount); |
| 1194 | sal_Int16 iDefault16 = static_cast<sal_Int16>(iDefault); |
| 1195 | aOut.writeInt16( 0 ); // nVersion |
| 1196 | aOut.writeInt16( nLocaleCount16 ); |
| 1197 | aOut.writeInt16( iDefault16 ); |
| 1198 | |
| 1199 | // Write data positions |
| 1200 | sal_Int32 nDataPos = 6 + 4 * (nLocaleCount + 1); |
| 1201 | for( iLocale = 0; iLocale < nLocaleCount; iLocale++ ) |
| 1202 | { |
| 1203 | aOut.writeInt32( nDataPos ); |
| 1204 | |
| 1205 | Sequence< sal_Int8 >& rSeq = aLocaleDataSeq[iLocale]; |
| 1206 | sal_Int32 nSeqLen = rSeq.getLength(); |
| 1207 | nDataPos += nSeqLen; |
| 1208 | } |
| 1209 | // Write final position |
| 1210 | aOut.writeInt32( nDataPos ); |
| 1211 | |
| 1212 | // Write data |
| 1213 | Reference< io::XOutputStream > xOutputStream = aOut.getOutputStream(); |
| 1214 | if( xOutputStream.is() ) |
| 1215 | { |
| 1216 | for( iLocale = 0; iLocale < nLocaleCount; iLocale++ ) |
| 1217 | { |
| 1218 | Sequence< sal_Int8 >& rSeq = aLocaleDataSeq[iLocale]; |
| 1219 | xOutputStream->writeBytes( rSeq ); |
| 1220 | } |
| 1221 | } |
| 1222 | |
| 1223 | Sequence< sal_Int8 > aRetSeq = aOut.closeAndGetData(); |
| 1224 | return aRetSeq; |
| 1225 | } |
no test coverage detected