Changeset 25 for trunk/NewView/CmdLineParameterUnit.pas
- Timestamp:
- Aug 1, 2006, 8:51:54 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NewView/CmdLineParameterUnit.pas
r23 r25 47 47 ownerWindow : integer; 48 48 windowTitle : string; 49 fileName : string; 50 topic : string; 51 { 52 TopicParam: string; 53 FilenamesParam: TAString; 54 } 49 fileNames : string; 50 topics : string; 55 51 56 52 public … … 62 58 FUNCTION getLanguage : string; 63 59 FUNCTION getHelpManagerFlag : boolean; 60 FUNCTION setHelpManagerFlag(aNewValue : boolean) : boolean; 64 61 FUNCTION getHelpManagerWindow : integer; 65 62 FUNCTION getWindowPositionFlag : boolean; … … 67 64 FUNCTION getOwnerWindow : integer; 68 65 FUNCTION getWindowTitle : string; 69 FUNCTION getFileName : string;70 FUNCTION getTopic : string;66 FUNCTION getFileNames : string; 67 FUNCTION getTopics : string; 71 68 PROCEDURE parseCmdLine(aSplittedCmdLine : TStringList); 72 69 end; … … 78 75 // returns a string containing the whole 79 76 // command line parametes 80 FUNCTION splitCmdLineParameter(aCmdLineString : String; var aR C : Integer) : TStringList;77 FUNCTION splitCmdLineParameter(aCmdLineString : String; var aResult : TStringList) : integer; 81 78 82 79 // Return true if param matches the form … … 145 142 146 143 144 FUNCTION TCmdLineParameters.setHelpManagerFlag(aNewValue : boolean) : boolean; 145 begin 146 helpManagerFlag := aNewValue; 147 result := helpManagerFlag; 148 end; 149 150 147 151 FUNCTION TCmdLineParameters.getHelpManagerWindow : integer; 148 152 begin … … 175 179 176 180 177 FUNCTION TCmdLineParameters.getFileName : string;178 begin 179 result := fileName ;180 end; 181 182 183 FUNCTION TCmdLineParameters.getTopic : string;184 begin 185 result := topic ;181 FUNCTION TCmdLineParameters.getFileNames : string; 182 begin 183 result := fileNames; 184 end; 185 186 187 FUNCTION TCmdLineParameters.getTopics : string; 188 begin 189 result := topics; 186 190 end; 187 191 … … 193 197 tmpParameterValue : string; 194 198 begin 199 ProfileEvent( 'ParseCommandLineParameters started' ); 200 195 201 // reset the whole object 196 202 showUsageFlag := false; … … 207 213 windowTitle := ''; 208 214 209 filename := '';210 topic := '';215 filenames := ''; 216 topics := ''; 211 217 212 218 // start parsing … … 273 279 else 274 280 begin 275 if length(filename ) = 0 then281 if length(filenames) = 0 then 276 282 begin 277 283 // filename 278 fileName := tmpParameter;284 fileNames := tmpParameter; 279 285 end 280 286 else 281 287 begin 282 288 // search (topic) parameter... append all remaining thingies 283 if topic <> '' then289 if topics <> '' then 284 290 begin 285 topic := topic+ ' ';291 topics := topics + ' '; 286 292 end; 287 topic := topic+ tmpParameter;293 topics := topics + tmpParameter; 288 294 end; 289 295 end; 290 296 end; 297 298 ProfileEvent('Parameters parsed'); 299 ProfileEvent(' Filename(s): ' + fileNames); 300 ProfileEvent(' Topic(s): ' + topics); 301 ProfileEvent( '...done' ); 291 302 end; 292 303 … … 307 318 308 319 309 FUNCTION splitCmdLineParameter(aCmdLineString : String; var aR C : Integer) : TStringList;320 FUNCTION splitCmdLineParameter(aCmdLineString : String; var aResult : TStringList) : integer; 310 321 CONST 311 322 STATE_BEFORE = 0; … … 319 330 tmpState : INTEGER; 320 331 tmpCurrentCommand : String; 321 tmpResult : TStringList;322 332 323 333 BEGIN 324 aRC := SUCCESS; 325 tmpResult := TStringList.Create; 334 result := SUCCESS; 335 aResult.Clear; 336 326 337 tmpState := 0; 327 338 tmpCurrentCommand := ''; … … 337 348 STATE_INSIDE : 338 349 begin 339 tmpResult.add(tmpCurrentCommand);350 aResult.add(tmpCurrentCommand); 340 351 tmpCurrentCommand := ''; 341 352 tmpState := STATE_BEFORE; … … 343 354 STATE_INSIDE_QUOTED_START_QUOTE : 344 355 begin 345 tmpResult.add(tmpCurrentCommand);356 aResult.add(tmpCurrentCommand); 346 357 tmpCurrentCommand := ''; 347 358 tmpState := STATE_BEFORE; … … 409 420 STATE_INSIDE : 410 421 begin 411 tmpResult.add(tmpCurrentCommand);422 aResult.add(tmpCurrentCommand); 412 423 end; 413 424 STATE_INSIDE_QUOTED_START_QUOTE : 414 425 begin 415 tmpResult.add(tmpCurrentCommand);426 aResult.add(tmpCurrentCommand); 416 427 end; 417 428 ELSE 418 429 begin 419 aRC:= ERROR_UNMATCHED_QUOTE;420 tmpResult.add(tmpCurrentCommand);430 result := ERROR_UNMATCHED_QUOTE; 431 aResult.add(tmpCurrentCommand); 421 432 end; 422 433 end; 423 splitCmdLineParameter:= tmpResult;424 434 END; 425 435 … … 509 519 end; 510 520 521 511 522 END.
Note:
See TracChangeset
for help on using the changeset viewer.