CIGIPP/SymbolTextDefinition.pm

filter: Statementstmt 89.2% 91 / 102 Branchbran 53.1% 17 / 32 Conditioncond 33.3% 28 / 84 MC/DCmcdc 0.0% 0 / 32 Subroutinesub 100% 16 / 16 Podpod 100% 12 / 12 totaltotal 58.9% 164 / 278 CC 46 SCAR 36.7
CC
46
Cov
62%
font_ident
98.3
alignment
27.5
new
19.6
CRAP 39.2
« CIGIPP/ShortSymbolControl.pm ↑ Summary CIGIPP/ShortComponentControl.pm »
1 #
2 # Rinchi Common Image Generator Interface for Perl
3 # Class Identifier: f78b0320-200e-11de-bdbe-001c25551abc
4 # Author: Brian M. Ames
5 #
6  
7 package Rinchi::CIGIPP::SymbolTextDefinition;
8  
9 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 require Exporter;
15  
16 2 our @ISA = qw(Exporter);
17  
18 # Items to export into callers namespace by default. Note: do not export
19 # names by default without a very good reason. Use EXPORT_OK instead.
20 # Do not simply export all your public functions/methods/constants.
21  
22 # This allows declaration use Rinchi::CIGI::AtmosphereControl ':all';
23 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
24 # will save memory.
25 2 our %EXPORT_TAGS = ( 'all' => [ qw(
26
27 ) ] );
28  
29 2 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
30  
31 2 our @EXPORT = qw(
32
33 );
34  
35 2 our $VERSION = '0.01';
36  
37 # Preloaded methods go here.
38  
39 =head1 NAME
40  
41 Rinchi::CIGIPP::SymbolTextDefinition - Perl extension for the Common Image
42 Generator Interface - Symbol Text Definition data packet.
43 data packet.
44 =head1 SYNOPSIS
45  
46 use Rinchi::CIGIPP::SymbolTextDefinition;
47 my $sym_text = Rinchi::CIGIPP::SymbolTextDefinition->new();
48  
49 $packet_type = $sym_text->packet_type();
50 $packet_size = $sym_text->packet_size(243);
51 $symbol_ident = $sym_text->symbol_ident(29183);
52 $orientation = $sym_text->orientation(Rinchi::CIGIPP->LeftToRight);
53 $alignment = $sym_text->alignment(Rinchi::CIGIPP->TopCenter);
54 $font_ident = $sym_text->font_ident(Rinchi::CIGIPP->IGDefault);
55 $font_size = $sym_text->font_size(83.754);
56 $text = $sym_text->text("Hello World!");
57  
58 =head1 DESCRIPTION
59  
60 The Symbol Text Definition packet is used to define a string of text, as well
61 as its alignment, orientation, font, and size.
62  
63 Each text symbol is identified by a Symbol ID value that is unique from all
64 other symbols (text or otherwise). Every symbol must be created independently
65 with its own unique Symbol ID, even if two or more symbols are visually
66 identical.
67 Once a Symbol Text Definition packet describing a text symbol is sent to the
68 IG, the definition of that symbol will not change. If any Symbol Text
69 Definition, Symbol Circle Definition, Symbol Line Definition, or Symbol Clone
70 packet specifying the same Symbol ID is then received, the existing symbol will
71 be destroyed along with any children and a new symbol will be created using the
72 new definition packet.
73  
74 The Font ID attribute uniquely identifies a specific font and is defined by the
75 IG. A font is a unique combination of typeface, style (such as italic), and
76 weight (such as bold). Therefore, any special attribute of the font such as
77 bold or italics shall be identified using a separate Font ID. Table 37 defines
78 several default font styles; however, the exact typeface is IG-dependent. All
79 other font assignments are IG-defined.
80  
81 Font size is defined as the vertical space that a font occupies. This includes
82 the cap height as well as the heights of any ascenders, descenders, accent
83 marks, and vertical padding.
84  
85 The text string is composed of multiple UTF-8 character data. The text must be
86 terminated by NULL, or zero (0). If the terminating byte is not the last byte
87 before an eight-byte boundary, then the remainder of the packet must be padded
88 with zeroes up to the next eight-byte boundary. Zero-length text strings must
89 be terminated with four bytes containing NULL to maintain eight-byte alignment.
90 The maximum text length is dependent upon the sizes of the individual UTF-8
91 character data and, therefore, to a large extent, the language being used.
92  
93 The Packet Size attribute must contain the number of bytes up to and including
94 the Font Size attribute (a total of 12 bytes) and the total number of bytes
95 within the text, including the terminating NULL and any padding. This value
96 must be an even multiple of eight (8). For example, if the string "Hello
97 World!" were sent to the IG, the packet size would be 12 + 24, or 32 bytes.
98  
99 When the IG creates a new symbol, that symbol is always hidden by default. The
100 symbol is not made visible until the Host sends a Symbol Control packet or
101 Short Symbol Control packet with the Symbol State attribute set to Visible (1).
102  
103 =head2 EXPORT
104  
105 None by default.
106  
107 #==============================================================================
108  
109 =item new $sym_text = Rinchi::CIGIPP::SymbolTextDefinition->new()
110  
111 Constructor for Rinchi::SymbolTextDefinition.
112  
113 =cut
114  
115 2 ▶sub new {
Subroutine new: called CC=7 SCAR=29.8
Pod documented
116 2 my $class = shift;
117 2 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
118  
119 2 my $self = {
120 '_Buffer' => '',
121 '_ClassIdent' => 'f78b0320-200e-11de-bdbe-001c25551abc',
122 '_Pack' => 'CCSCCSf',
123 '_Swap1' => 'CCvCCvV',
124 '_Swap2' => 'CCnCCnN',
125 'packetType' => 30,
126 'packetSize' => 16,
127 'symbolIdent' => 0,
128 '_bitfields1' => 0, # Includes bitfields orientation, and alignment.
129 'orientation' => 0,
130 'alignment' => 0,
131 'fontIdent' => 0,
132 '_unused54' => 0,
133 'fontSize' => 0,
134 'text' => '',
135 '_pad' => "\0\0\0\0",
136 };
137  
138 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
139 0 ▶ if (ref($_[0]) eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $_[0] eq 'ARRAY') { } 0 0 0
elsif (ref $_[0] eq 'HASH') { } 0 0 0
140 0 $self->{'_Buffer'} = $_[0][0];
141 } elsif (ref($_[0]) eq 'HASH') {
142 0 foreach my $attr (keys %{$_[0]}) {
143 0 ▶ $self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/);
Branch: 1 branch
BranchTrueFalseTotal
unless $attr =~ /^_/ 0 0 0
144 }
145 }
146 }
147  
148 2 bless($self,$class);
149 2 return $self;
150 }
151  
152 #==============================================================================
153  
154 =item sub packet_type()
155  
156 $value = $sym_text->packet_type();
157  
158 Data Packet Identifier.
159  
160 This attribute identifies this data packet as the Symbol Text Definition
161 packet. The value of this attribute must be 30.
162  
163 =cut
164  
165 2 ▶sub packet_type() {
Subroutine packet_type: called CC=1 SCAR=0.0
Pod documented
166 2 my ($self) = @_;
167 2 return $self->{'packetType'};
168 }
169  
170 #==============================================================================
171  
172 =item sub packet_size([$newValue])
173  
174 $value = $sym_text->packet_size($newValue);
175  
176 Data Packet Size.
177  
178 This attribute indicates the number of bytes in this data packet. The value of
179 this attribute must be an even multiple of 8 ranging from 16 to 248.
180  
181 =cut
182  
183 2 ▶sub packet_size() {
Subroutine packet_size: called CC=1 SCAR=0.0
Pod documented
184 2 my ($self,$nv) = @_;
185 # if (defined($nv)) {
186 # $self->{'packetSize'} = $nv;
187 # }
188 2 return $self->{'packetSize'};
189 }
190  
191 #==============================================================================
192  
193 =item sub symbol_ident([$newValue])
194  
195 $value = $sym_text->symbol_ident($newValue);
196  
197 Symbol ID.
198  
199 This attribute specifies the identifier of the symbol that is being defined.
200  
201 This identifier must be unique among all existing symbols. If a symbol with the
202 specified identifier already exists, then that symbol and any children will be
203 destroyed and a new symbol created.
204  
205 =cut
206  
207 3 ▶sub symbol_ident() {
Subroutine symbol_ident: called CC=2 SCAR=6.9
Pod documented
208 3 my ($self,$nv) = @_;
209 3 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 1 3
210 2 $self->{'symbolIdent'} = $nv;
211 }
212 3 return $self->{'symbolIdent'};
213 }
214  
215 #==============================================================================
216  
217 =item sub orientation([$newValue])
218  
219 $value = $sym_text->orientation($newValue);
220  
221 Orientation.
222  
223 This attribute specifies the orientation of the text.
224  
225 LeftToRight 0
226 TopToBottom 1
227 RightToLeft 2
228 BottomToTop 3
229  
230 =cut
231  
232 3 ▶sub orientation() {
Subroutine orientation: called CC=6 SCAR=21.2
Pod documented
233 3 my ($self,$nv) = @_;
234 3 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 1 3
235 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2 or $nv == 3) { } 2 0 2
Condition33%3/9
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/4
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
$nv == 0 $nv == 1 $nv == 2 $nv == 3
Truth table20%1/5
A or B or C or D
A= $nv == 0B= $nv == 1C= $nv == 2D= $nv == 3
ABCDresult
1XXX1
01XX1
001X1
00011
00000
236 2 $self->{'orientation'} = $nv;
237 2 $self->{'_bitfields1'} |= ($nv << 4) &0x30;
238 } else {
239 0 carp "orientation must be 0 (LeftToRight), 1 (TopToBottom), 2 (RightToLeft), or 3 (BottomToTop).";
240 }
241 }
242 3 return (($self->{'_bitfields1'} & 0x30) >> 4);
243 }
244  
245 #==============================================================================
246  
247 =item sub alignment([$newValue])
248  
249 $value = $sym_text->alignment($newValue);
250  
251 Alignment.
252  
253 This attribute specifies the position of the symbol's reference point in
254 relation to the text. If the text has multiple lines, this attribute also
255 determines whether the text is left-, center-, or right-justified.
256  
257 TopLeft 0
258 TopCenter 1
259 TopRight 2
260 CenterLeft 3
261 Center 4
262 CenterRight 5
263 BottomLeft 6
264 BottomCenter 7
265 BottomRight 8
266  
267 =cut
268  
269 3 ▶sub alignment() {
Subroutine alignment: called CC=11 SCAR=33.1
Pod documented
270 3 my ($self,$nv) = @_;
271 3 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 1 3
272 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3) or ($nv==4) or ($nv==5) or ($nv==6) or ($nv==7) or ($nv==8)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8) { } 2 0 2
Condition33%8/24
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
020
MC/DC0%0/9
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8
$nv == 0 $nv == 1 $nv == 2 $nv == 3 $nv == 4 $nv == 5 $nv == 6 $nv == 7 $nv == 8
Truth table10%1/10
A or B or C or D or E or F or G or H or I
A= $nv == 0B= $nv == 1C= $nv == 2D= $nv == 3E= $nv == 4F= $nv == 5G= $nv == 6H= $nv == 7I= $nv == 8
ABCDEFGHIresult
1XXXXXXXX1
01XXXXXXX1
001XXXXXX1
0001XXXXX1
00001XXXX1
000001XXX1
0000001XX1
00000001X1
0000000011
0000000000
273 2 $self->{'alignment'} = $nv;
274 2 $self->{'_bitfields1'} |= $nv &0x0F;
275 } else {
276 0 carp "alignment must be 0 (TopLeft), 1 (TopCenter), 2 (TopRight), 3 (CenterLeft), 4 (Center), 5 (CenterRight), 6 (BottomLeft), 7 (BottomCenter), or 8 (BottomRight).";
277 }
278 }
279 3 return ($self->{'_bitfields1'} & 0x0F);
280 }
281  
282 #==============================================================================
283  
284 =item sub font_ident([$newValue])
285  
286 $value = $sym_text->font_ident($newValue);
287  
288 Font ID.
289  
290 This attribute specifies the font to be used for this text symbol.
291  
292 This document defines a set of default proportional (variable-width) and
293 monospace (constant-width) font styles for interoperability; however, the exact
294 typefaces used will be IG-dependent.
295  
296 Font IDs 17 through 255 are entirely IG-defined.
297  
298 IGDefault 0
299 ProportionalSansSerif 1
300 ProportionalSanSerifBold 2
301 ProportionalSansSerifItalic 3
302 ProportionalSansSerifBoldItalic 4
303 ProportionalSerif 5
304 ProportionalSerifBold 6
305 ProportionalSerifItalic 7
306 ProportionalSerifBoldItalic 8
307 MonospaceSansSerif 9
308 MonospaceSansSerifBold 10
309 MonospaceSansSerifItalic 11
310 MonospaceSansSerifBoldItalic 12
311 MonospaceSerif 13
312 MonospaceSerifBold 14
313 MonospaceSerifItalic 15
314 MonospaceSerifBoldItalic 16
315  
316 =cut
317  
318 2 ▶sub font_ident() {
Subroutine font_ident: called CC=19 SCAR=45.9
Pod documented
319 2 my ($self,$nv) = @_;
320 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
321 2 ▶ if (($nv==0) or ($nv==1) or ($nv==2) or ($nv==3) or ($nv==4) or ($nv==5) or ($nv==6) or ($nv==7) or ($nv==8) or ($nv==9) or ($nv==10) or ($nv==11) or ($nv==12) or ($nv==13) or ($nv==14) or ($nv==15) or ($nv==16)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13 or $nv == 14 or $nv == 15 or $nv == 16) { } 2 0 2
Condition33%16/48
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13 or $nv == 14 or $nv == 15 or $nv == 16
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13 or $nv == 14 or $nv == 15
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13 or $nv == 14
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1 or $nv == 2
l!l&&r!l&&!r
200
$nv == 0 or $nv == 1
l!l&&r!l&&!r
200
MC/DC0%0/17
$nv == 0 or $nv == 1 or $nv == 2 or $nv == 3 or $nv == 4 or $nv == 5 or $nv == 6 or $nv == 7 or $nv == 8 or $nv == 9 or $nv == 10 or $nv == 11 or $nv == 12 or $nv == 13 or $nv == 14 or $nv == 15 or $nv == 16
too many conditions
322 2 $self->{'fontIdent'} = $nv;
323 } else {
324 0 carp "font_ident must be 0 (IGDefault), 1 (ProportionalSansSerif), 2 (ProportionalSanSerifBold), 3 (ProportionalSansSerifItalic), 4 (ProportionalSansSerifBoldItalic), 5 (ProportionalSerif), 6 (ProportionalSerifBold), 7 (ProportionalSerifItalic), 8 (ProportionalSerifBoldItalic), 9 (MonospaceSansSerif), 10 (MonospaceSansSerifBold), 11 (MonospaceSansSerifItalic), 12 (MonospaceSansSerifBoldItalic), 13 (MonospaceSerif), 14 (MonospaceSerifBold), 15 (MonospaceSerifItalic), or 16 (MonospaceSerifBoldItalic).";
325 }
326 }
327 2 return $self->{'fontIdent'};
328 }
329  
330 #==============================================================================
331  
332 =item sub font_size([$newValue])
333  
334 $value = $sym_text->font_size($newValue);
335  
336 Font Size.
337  
338 This attribute specifies the font size in terms of the vertical units defined
339 by the symbol surface's 2D coordinate system (see CIGI ICD Section 3.4.5.1).
340  
341 =cut
342  
343 2 ▶sub font_size() {
Subroutine font_size: called CC=2 SCAR=7.0
Pod documented
344 2 my ($self,$nv) = @_;
345 2 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 2 0 2
346 2 $self->{'fontSize'} = $nv;
347 }
348 2 return $self->{'fontSize'};
349 }
350  
351 #==============================================================================
352  
353 =item sub text([$newValue])
354  
355 $value = $sym_text->text($newValue);
356  
357 Text.
358  
359 These 8-bit data are used to store the UTF-8 code points in the string.
360  
361 Note: The maximum length of the string, including a terminating NULL, is 236
362 bytes. The pack method will add terminating and padding NULLs as needed.
363  
364 =cut
365  
366 4 ▶sub text() {
Subroutine text: called CC=3 SCAR=11.1
Pod documented
367 4 my ($self,$nv) = @_;
368 4 ▶ if (defined($nv)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $nv) 3 1 4
369 3 my $len = length($nv);
370 3 ▶ if ($len < 236) {
Branch: 1 branch
BranchTrueFalseTotal
if ($len < 236) { } 3 0 3
371 3 $self->{'text'} = $nv;
372 3 $self->{'_pad'} = substr("\0\0\0\0\0\0\0\0",(($len+4)%8));
373 3 $self->{'packetSize'} = $len + 12 + length($self->{'_pad'});
374 } else {
375 0 carp "New value exceeds 235 bytes";
376 }
377 }
378 4 return $self->{'text'};
379 }
380  
381 #==========================================================================
382  
383 =item sub pack()
384  
385 $value = $sym_text->pack();
386  
387 Returns the packed data packet.
388  
389 =cut
390  
391 5 ▶sub pack($) {
Subroutine pack: called CC=1 SCAR=0.0
Pod documented
392 5 my $self = shift ;
393
394 $self->{'_Buffer'} = CORE::pack($self->{'_Pack'},
395 $self->{'packetType'},
396 $self->{'packetSize'},
397 $self->{'symbolIdent'},
398 $self->{'_bitfields1'}, # Includes bitfields unused53, orientation, and alignment.
399 $self->{'fontIdent'},
400 $self->{'_unused54'},
401 $self->{'fontSize'}
402 5 ) . $self->{'text'} . $self->{'_pad'};
403  
404 5 return $self->{'_Buffer'};
405 }
406  
407 #==========================================================================
408  
409 =item sub unpack()
410  
411 $value = $sym_text->unpack();
412  
413 Unpacks the packed data packet.
414  
415 =cut
416  
417 1 ▶sub unpack($) {
Subroutine unpack: called CC=2 SCAR=6.9
Pod documented
418 1 my $self = shift @_;
419
420 1 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 1 1
421 0 $self->{'_Buffer'} = shift @_;
422 }
423 1 my ($a,$b,$c,$d,$e,$f,$g) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'});
424 1 my $h = substr($self->{'_Buffer'},12);
425 1 $h =~ s/(\0+)$//;
426 1 my $i = $1;
427 1 $self->{'packetType'} = $a;
428 1 $self->{'packetSize'} = $b;
429 1 $self->{'symbolIdent'} = $c;
430 1 $self->{'_bitfields1'} = $d; # Includes bitfields unused53, orientation, and alignment.
431 1 $self->{'fontIdent'} = $e;
432 1 $self->{'_unused54'} = $f;
433 1 $self->{'fontSize'} = $g;
434 1 $self->{'text'} = $h;
435 1 $self->{'_pad'} = $i;
436  
437 1 $self->{'orientation'} = $self->orientation();
438 1 $self->{'alignment'} = $self->alignment();
439  
440 1 return $self->{'_Buffer'};
441 }
442  
443 #==========================================================================
444  
445 =item sub byte_swap()
446  
447 $obj_name->byte_swap();
448  
449 Byte swaps the packed data packet.
450  
451 =cut
452  
453 1 ▶sub byte_swap($) {
Subroutine byte_swap: called CC=2 SCAR=7.1
Pod documented
454 1 my $self = shift @_;
455
456 1 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 1 1
457 0 $self->{'_Buffer'} = shift @_;
458 } else {
459 1 $self->pack();
460 }
461 1 my ($a,$b,$c,$d,$e,$f,$g) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'});
462 1 my $padded_text = substr($self->{'_Buffer'},12);
463  
464 1 $self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g) . $padded_text;
465 1 $self->unpack();
466  
467 1 return $self->{'_Buffer'};
468 }
469  
470 2 1;
471 __END__
« CIGIPP/ShortSymbolControl.pm ↑ Summary CIGIPP/ShortComponentControl.pm »