MCPcopy Create free account
hub / github.com/dirkvranckaert/AndroidDecompiler / nextLine

Method nextLine

astyle/src/astyle_main.cpp:120–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118 */
119template<typename T>
120string ASStreamIterator<T>::nextLine(bool emptyLineWasDeleted)
121{
122 // verify that the current position is correct
123 assert (peekStart == 0);
124
125 // a deleted line may be replaced if break-blocks is requested
126 // this sets up the compare to check for a replaced empty line
127 if (prevLineDeleted)
128 {
129 prevLineDeleted = false;
130 checkForEmptyLine = true;
131 }
132 if (!emptyLineWasDeleted)
133 prevBuffer = buffer;
134 else
135 prevLineDeleted = true;
136
137 // read the next record
138 buffer.clear();
139 char ch;
140 inStream->get(ch);
141
142 while (!inStream->eof() && ch != '\n' && ch != '\r')
143 {
144 buffer.append(1, ch);
145 inStream->get(ch);
146 }
147
148 if (inStream->eof())
149 {
150 return buffer;
151 }
152
153 int peekCh = inStream->peek();
154
155 // find input end-of-line characters
156 if (!inStream->eof())
157 {
158 if (ch == '\r') // CR+LF is windows otherwise Mac OS 9
159 {
160 if (peekCh == '\n')
161 {
162 inStream->get();
163 eolWindows++;
164 }
165 else
166 eolMacOld++;
167 }
168 else // LF is Linux, allow for improbable LF/CR
169 {
170 if (peekCh == '\r')
171 {
172 inStream->get();
173 eolWindows++;
174 }
175 else
176 eolLinux++;
177 }

Callers 3

formatCinToCoutMethod · 0.45
formatFileMethod · 0.45
AStyleMainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected