aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/request_reply.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexgb/xgbgen/request_reply.go')
-rw-r--r--nexgb/xgbgen/request_reply.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/nexgb/xgbgen/request_reply.go b/nexgb/xgbgen/request_reply.go
index 5032e31..ab3d9d3 100644
--- a/nexgb/xgbgen/request_reply.go
+++ b/nexgb/xgbgen/request_reply.go
@@ -6,6 +6,22 @@ import (
"unicode"
)
+// Doc contains any documentation, if present. Example C code is excluded.
+type Doc struct {
+ Brief string // short description
+ Description string // long description
+ Fields map[string]string // from field name to description
+ Errors map[string]string // from error type to description
+}
+
+// DescribeField is an accessor that supports nil receivers.
+func (d *Doc) DescribeField(name string) string {
+ if d == nil {
+ return ""
+ }
+ return d.Fields[name]
+}
+
// Request represents all XML 'request' nodes.
// If the request doesn't have a reply, Reply is nil.
type Request struct {
@@ -15,6 +31,7 @@ type Request struct {
Combine bool // Not currently used.
Fields []Field // All fields in the request.
Reply *Reply // A reply, if one exists for this request.
+ Doc Doc // Documentation.
}
type Requests []*Request
@@ -126,6 +143,7 @@ func (r *Request) Size(c *Context) Size {
// Reply encapsulates the fields associated with a 'reply' element.
type Reply struct {
Fields []Field
+ Doc Doc
}
// Size gets the number of bytes in this request's reply.