Ignore:
Timestamp:
Aug 1, 2006, 8:51:54 PM (19 years ago)
Author:
RBRi
Message:

refactoring for cmd line parameters handling finished

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Library/ACLStringUtility.pas

    r17 r25  
    284284Function BoolToStr( const b: boolean ): string;
    285285
    286 // Return true if param matches the form
    287 // /Flag:value
    288 // dash (-) can be used instead of slash (/)
    289 // colon can be omitted
    290 function MatchValueParam( const Param: string;
    291                           const Flag: string;
    292                           var Value: string ): boolean;
    293 
    294 // Return true if param matches the form
    295 // /Flag
    296 // dash (-) can be used instead of slash (/)
    297 function MatchFlagParam( const Param: string;
    298                          const Flag: string ): boolean;
    299286
    300287Implementation
     
    14481435end;
    14491436
    1450 // Return true if param matches the form
    1451 // /Flag:value
    1452 // dash (-) can be used instead of slash (/)
    1453 // colon can be omitted
    1454 function MatchValueParam( const Param: string;
    1455                           const Flag: string;
    1456                           var Value: string ): boolean;
    1457 begin
    1458   Result := false;
    1459 
    1460   if Param = '' then
    1461     exit;
    1462 
    1463   if     ( Param[ 1 ] <> '/' )
    1464      and ( Param[ 1 ] <> '-' ) then
    1465     exit;
    1466 
    1467   if not StringsSame( Copy( Param, 2, Length( Flag ) ),
    1468                       Flag ) then
    1469     exit;
    1470 
    1471   Result := true;
    1472 
    1473   Value := StrRightFrom( Param, 2 + Length( Flag ) );
    1474   if Value <> '' then
    1475     if Value[ 1 ] = ':' then
    1476       Delete( Value, 1, 1 );
    1477 end;
    1478 
    1479 // Return true if param matches the form
    1480 // /Flag
    1481 // dash (-) can be used instead of slash (/)
    1482 function MatchFlagParam( const Param: string;
    1483                          const Flag: string ): boolean;
    1484 begin
    1485   Result := false;
    1486 
    1487   if Param = '' then
    1488     exit;
    1489 
    1490   if     ( Param[ 1 ] <> '/' )
    1491      and ( Param[ 1 ] <> '-' ) then
    1492     exit;
    1493 
    1494   Result := StringsSame( StrRightFrom( Param, 2 ),
    1495                          Flag );
    1496 end;
    1497 
    14981437Initialization
    14991438  InitHexDigitMap;
Note: See TracChangeset for help on using the changeset viewer.