src/ldtypes.cpp

changeset 270
f5f2353af0d9
parent 269
2d71227f35cb
child 274
d232fe4d88a6
equal deleted inserted replaced
269:2d71227f35cb 270:f5f2353af0d9
71 contents = _zContent; 71 contents = _zContent;
72 reason = _zReason; 72 reason = _zReason;
73 } 73 }
74 74
75 // ============================================================================= 75 // =============================================================================
76 str LDComment::getContents () { 76 str LDComment::raw () {
77 return fmt ("0 %s", text.chars ()); 77 return fmt ("0 %s", text.chars ());
78 } 78 }
79 79
80 str LDSubfile::getContents () { 80 str LDSubfile::raw () {
81 str val = fmt ("1 %d %s ", color (), position ().stringRep (false).chars ()); 81 str val = fmt ("1 %d %s ", color (), position ().stringRep (false).chars ());
82 val += transform ().stringRep (); 82 val += transform ().stringRep ();
83 val += ' '; 83 val += ' ';
84 val += fileInfo ()->name (); 84 val += fileInfo ()->name ();
85 return val; 85 return val;
86 } 86 }
87 87
88 str LDLine::getContents () { 88 str LDLine::raw () {
89 str val = fmt ("2 %d", color ()); 89 str val = fmt ("2 %d", color ());
90 90
91 for (ushort i = 0; i < 2; ++i) 91 for (ushort i = 0; i < 2; ++i)
92 val += fmt (" %s", coords[i].stringRep (false).chars ()); 92 val += fmt (" %s", coords[i].stringRep (false).chars ());
93 93
94 return val; 94 return val;
95 } 95 }
96 96
97 str LDTriangle::getContents () { 97 str LDTriangle::raw () {
98 str val = fmt ("3 %d", color ()); 98 str val = fmt ("3 %d", color ());
99 99
100 for (ushort i = 0; i < 3; ++i) 100 for (ushort i = 0; i < 3; ++i)
101 val += fmt (" %s", coords[i].stringRep (false).chars ()); 101 val += fmt (" %s", coords[i].stringRep (false).chars ());
102 102
103 return val; 103 return val;
104 } 104 }
105 105
106 str LDQuad::getContents () { 106 str LDQuad::raw () {
107 str val = fmt ("4 %d", color ()); 107 str val = fmt ("4 %d", color ());
108 108
109 for (ushort i = 0; i < 4; ++i) 109 for (ushort i = 0; i < 4; ++i)
110 val += fmt (" %s", coords[i].stringRep (false).chars ()); 110 val += fmt (" %s", coords[i].stringRep (false).chars ());
111 111
112 return val; 112 return val;
113 } 113 }
114 114
115 str LDCondLine::getContents () { 115 str LDCondLine::raw () {
116 str val = fmt ("5 %d", color ()); 116 str val = fmt ("5 %d", color ());
117 117
118 // Add the coordinates 118 // Add the coordinates
119 for (ushort i = 0; i < 4; ++i) 119 for (ushort i = 0; i < 4; ++i)
120 val += fmt (" %s", coords[i].stringRep (false).chars ()); 120 val += fmt (" %s", coords[i].stringRep (false).chars ());
121 121
122 return val; 122 return val;
123 } 123 }
124 124
125 str LDGibberish::getContents () { 125 str LDGibberish::raw () {
126 return contents; 126 return contents;
127 } 127 }
128 128
129 str LDVertex::getContents () { 129 str LDVertex::raw () {
130 return fmt ("0 !LDFORGE VERTEX %d %s", color (), pos.stringRep (false).chars()); 130 return fmt ("0 !LDFORGE VERTEX %d %s", color (), pos.stringRep (false).chars());
131 } 131 }
132 132
133 str LDEmpty::getContents () { 133 str LDEmpty::raw () {
134 return str (); 134 return str ();
135 } 135 }
136 136
137 // ============================================================================= 137 // =============================================================================
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
144 "CW", 144 "CW",
145 "NOCERTIFY", 145 "NOCERTIFY",
146 "INVERTNEXT", 146 "INVERTNEXT",
147 }; 147 };
148 148
149 str LDBFC::getContents () { 149 str LDBFC::raw () {
150 return fmt ("0 BFC %s", LDBFC::statements[type]); 150 return fmt ("0 BFC %s", LDBFC::statements[type]);
151 } 151 }
152 152
153 // ============================================================================= 153 // =============================================================================
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
641 } 641 }
642 642
643 // ============================================================================= 643 // =============================================================================
644 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 644 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
645 // ============================================================================= 645 // =============================================================================
646 str LDRadial::getContents () { 646 str LDRadial::raw () {
647 return fmt ("0 !LDFORGE RADIAL %s %d %d %d %d %s %s", 647 return fmt ("0 !LDFORGE RADIAL %s %d %d %d %d %s %s",
648 str (radialTypeName ()).upper ().strip (' ').c (), 648 str (radialTypeName ()).upper ().strip (' ').c (),
649 color (), segments (), divisions (), number (), 649 color (), segments (), divisions (), number (),
650 position ().stringRep (false).chars (), transform ().stringRep().chars ()); 650 position ().stringRep (false).chars (), transform ().stringRep().chars ());
651 } 651 }

mercurial