InputPreprocessor

버전 1.0.0.0 (18.7 KB) 작성자: per isakson
Parses, adds defaults and validates the input of functions and methods
다운로드 수: 806
업데이트 날짜: 2010/4/19

라이선스 보기

InputPreprocessor provides an alternate interface to the class, inputParser, together with the function, validateattributes. It exposes most of the functionalities of theese two. In addition to the constraints (attributes) of validateattributes the user can add new constraints.

The goal is that InputPreprocessor shall help the user to make fewer trivial mistakes and write better code. That is, write code that is easier to understand and maintain. Furhermore, the code shall be an essential part of the documentation of the input arguments.

InputPreprocessor is not for all functions/methods. Especially, it should not be used when speed is a critical isssue.

Syntax:
ipp = InputPreprocessor( CA );
ipv = ipp.parse( input_argument_list );

where CA is a cell array with one row for each input argument of the function/method. The columns contain:
1. integer {1,2,3} chooses between: {addRequired,addOptional,addParamValue}
2. the name of the input argument
3. the default value of the input argument
4. the names of the classes that are allowed for the value
5. constraints on the value of the input argument

ipv is a name/value structure, which holds the complete and validated input data.

Documentation: InputPreprocessor_demo.html, which is generated by PUBLISH, discusses and demonstrate the use and behaviour of InputPreprocessor. The code is commented. However, there is no manual.

InputPreprocessor is a class under construction. However, it allready helps me make fewer trivial mistakes and write better code. I think it is worth while to develop it further.

I would appreciate comments and critisism on this contribution. I have no experience of other modern programming environment. I fear I'm inventing a wheel and that the current version of InputPreprocessor is more like a square.

인용 양식

per isakson (2024). InputPreprocessor (https://www.mathworks.com/matlabcentral/fileexchange/27296-inputpreprocessor), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2009b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 String Parsing에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0