Documentation
¶
Index ¶
- Variables
- func AnyToString(value any) string
- func GetContinuousDigitsIndices(name string) (startIndex int, endIndex int)
- func NewFormatConfig(classIndentSize int, fieldIndentSize int, fieldSize int) formatConfig
- type ClassDef
- type ExtPattern
- type ExtensibleDef
- type FieldDef
- type Fields
- type IDD
- type IDF
- func (idf *IDF) AddObject(className string, initialValues Fields, defaultValues ...bool) (*IDFObject, error)
- func (idf *IDF) Format(cfg formatConfig) string
- func (idf *IDF) GetObjectByName(className string, objectName string) (*IDFObject, error)
- func (idf *IDF) GetObjects(className string) []*IDFObject
- func (idf *IDF) RemoveObject(target *IDFObject) error
- func (idf *IDF) Save(filename string, cfg ...formatConfig) error
- func (idf *IDF) String() string
- func (idf *IDF) WriteTo(w io.Writer) (int64, error)
- type IDFObject
- func (obj *IDFObject) Format(cfg formatConfig) string
- func (obj *IDFObject) GetFloat(fieldName string) float64
- func (obj *IDFObject) GetFloatErr(fieldName string) (float64, error)
- func (obj *IDFObject) GetInt(fieldName string) int
- func (obj *IDFObject) GetIntErr(fieldName string) (int, error)
- func (obj *IDFObject) GetString(fieldName string) string
- func (obj *IDFObject) GetStringErr(fieldName string) (string, error)
- func (obj *IDFObject) Set(fieldName string, value any) error
- func (obj *IDFObject) SetByIndex(fieldIndex int, value any)
- func (obj *IDFObject) String() string
- func (obj *IDFObject) Update(values Fields) error
- func (obj *IDFObject) WriteTo(w io.Writer) (int64, error)
- type Lexer
- type Token
- type TokenType
Constants ¶
This section is empty.
Variables ¶
var MinimalFormatConfig = formatConfig{"", "", 0, true}
minimal format
Functions ¶
func GetContinuousDigitsIndices ¶
get start and end indices of continous digits (first appearance)
func NewFormatConfig ¶
generate formatConfig
Types ¶
type ClassDef ¶
type ClassDef struct {
Name string // original name with capitalization
Group string // \group
Fields []FieldDef // array of FieldDefs
MinFields int
BaseFieldIndexMap map[string]int // for fast indexing of fields (lowercase)
Extensible *ExtensibleDef // nil if empty
FieldIdxWithDefault []int // field indices with default value
}
IDD class definition (ex. Building, Zone)
func (*ClassDef) FindFieldIndex ¶
get index from field name (case-insensitive)
type ExtPattern ¶
type ExtPattern struct {
Prefix string
Suffix string
SearchPrefix string // for searching (lowercase)
SearchSuffix string // for searching (lowercase)
}
store extensible field names as Prefix + # + Suffix ex. "Vertex 1 X-coordinate" -> "Vertex ", " X-coordinate"
type ExtensibleDef ¶
type ExtensibleDef struct {
BeginIndex int // start index of the extensible fields
Size int // size of the extensible fields (ex. X, Y, Z coords -> 3)
Patterns []ExtPattern
}
IDD extensible field properties (used in ClassDef)
type FieldDef ¶
type FieldDef struct {
Name string
Required bool
Units string
Default string
Autosizable bool
Autocalculatable bool
Type string // alpha, real, integer, choice, etc.
Choices []string // possible values for "\type choice"
}
IDD field definition (ex. Outside_Boundary_Condition)
type IDD ¶
type IDD struct {
Version string
Classes map[string]*ClassDef // map for fast search (uppercase)
OrderedClasses []*ClassDef // for preserving order during export
}
IDD object that contains all of the definitions
func ParseIDDFile ¶
type IDF ¶
func (*IDF) AddObject ¶
func (idf *IDF) AddObject(className string, initialValues Fields, defaultValues ...bool) (*IDFObject, error)
add object to IDF AddObject(..., false) to ignore default values
func (*IDF) GetObjectByName ¶
get object by first field (likely name)
func (*IDF) GetObjects ¶
get object by class name
func (*IDF) RemoveObject ¶
remove object from IDF
type IDFObject ¶
func (*IDFObject) GetFloat ¶
get value of field as float (case-insensitive, ignores error). math.NaN() if empty
func (*IDFObject) GetFloatErr ¶
get value of field as float (case-insensitive, also returns error). math.NaN() if empty
func (*IDFObject) GetIntErr ¶
get value of field as int (case-insensitive, also returns error). -1 if empty
func (*IDFObject) GetString ¶
get value of field as string (case-insensitive, ignores error). "" if empty
func (*IDFObject) GetStringErr ¶
get value of field as string (case-insensitive, also returns error). "" if empty
func (*IDFObject) SetByIndex ¶
set value of field using field index
type Lexer ¶
type Lexer struct {
LineNum int // current line number (for debugging)
IsIDD bool // for IDD parsing
// contains filtered or unexported fields
}
lexer