octoid
octoid copied to clipboard
Include an option for where line breaks should occur
For example when importing the Intents
framework, this code is generated:
INBoatTrip = interface(NSObject)
['{AB88A6B6-EFAA-4D6D-A4D2-A55983C4E890}']
function arrivalBoatTerminalLocation: CLPlacemark; cdecl;
function boatName: NSString; cdecl;
function boatNumber: NSString; cdecl;
function departureBoatTerminalLocation: CLPlacemark; cdecl;
function initWithProvider(provider: NSString; boatName: NSString; boatNumber: NSString; tripDuration: INDateComponentsRange; departureBoatTerminalLocation: CLPlacemark; arrivalBoatTerminalLocation: CLPlacemark): Pointer; cdecl;
function provider: NSString; cdecl;
function tripDuration: INDateComponentsRange; cdecl;
end;
TINBoatTrip = class(TOCGenericImport<INBoatTripClass, INBoatTrip>) end;
Line breaks should occur using these rules:
- Break at the last parameter if any of it, or anything subsequent (e.g. result type etc) crosses the margin - in this case it would be
departureBoatTerminalLocation: CLPlacemark;
- if any part of this crosses the margin, the whole parameter should begin on the next line, indented 2 spaces from the text directly above it - in this case, the keywordfunction
. - If the remainder of the declaration also crosses the margin, apply the rule again, except indent at the same level as the last break
- Comments related to deprecation etc should not break
Other rules need to be formulated for other declarations. Using the rules above, with a margin of 150 characters, the class declaration would become this:
INBoatTrip = interface(NSObject)
['{AB88A6B6-EFAA-4D6D-A4D2-A55983C4E890}']
function arrivalBoatTerminalLocation: CLPlacemark; cdecl;
function boatName: NSString; cdecl;
function boatNumber: NSString; cdecl;
function departureBoatTerminalLocation: CLPlacemark; cdecl;
function initWithProvider(provider: NSString; boatName: NSString; boatNumber: NSString; tripDuration: INDateComponentsRange;
departureBoatTerminalLocation: CLPlacemark; arrivalBoatTerminalLocation: CLPlacemark): Pointer; cdecl;
function provider: NSString; cdecl;
function tripDuration: INDateComponentsRange; cdecl;
end;
TINBoatTrip = class(TOCGenericImport<INBoatTripClass, INBoatTrip>) end;