KiCad PCB EDA Suite
Loading...
Searching...
No Matches
data_block.cpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2025 Mark Roszko <[email protected]>
3 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
4 * Copyright (C) 2007 Ecma International (original Java source)
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * License info found here:
19 * https://www.loc.gov/preservation/digital/formats/fdd/fdd000491.shtml
20 */
21
22#include "data_block.h"
23
24using namespace U3D;
25
26
28{
29 m_dataSize = 0;
31 m_blockType = 0;
32 m_priority = 0;
33}
34
35
36void DATA_BLOCK::SetDataSize( uint32_t aSize )
37{
38 m_dataSize = aSize;
39 if( ( m_dataSize & 0x3 ) == 0 )
40 {
41 m_data.resize( aSize >> 2 );
42 }
43 else
44 {
45 m_data.resize( ( aSize >> 2 ) + 1 );
46 }
47}
48
49
50void DATA_BLOCK::SetMetaDataSize( uint32_t aSize )
51{
52 m_metaDataSize = aSize;
53 if( ( m_metaDataSize & 0x3 ) == 0 )
54 {
55 m_metaData.resize( aSize >> 2 );
56 }
57 else
58 {
59 m_metaData.resize( ( aSize >> 2 ) + 1 );
60 }
61}
62
63
64void DATA_BLOCK::SetMetaData( const std::vector<uint32_t>& aValue )
65{
66 if( aValue.size() == m_metaData.size() )
67 {
68 std::copy( aValue.begin(), aValue.end(), m_metaData.begin() );
69 }
70}
void SetMetaData(const std::vector< uint32_t > &aValue)
void SetMetaDataSize(uint32_t aSize)
std::vector< uint32_t > m_data
Definition data_block.h:73
uint32_t m_dataSize
Definition data_block.h:74
std::vector< uint32_t > m_metaData
Definition data_block.h:75
uint32_t m_priority
Definition data_block.h:77
uint32_t m_blockType
Definition data_block.h:78
void SetDataSize(uint32_t aSize)
uint32_t m_metaDataSize
Definition data_block.h:76