namespace Cobra.Core class EmptyStream implements IEnumerable def getEnumerator as IEnumerator yield break def getEnumerator as System.Collections.IEnumerator implements System.Collections.IEnumerable return .getEnumerator interface HasAppendKeyValue def appendKeyValue(key as String, value) """ Append a specific key+value pair to the receiver. Typically these are displayed in a grid or table, in the order they were appended. See also: HasAppendNonPropertyKeyValues """ interface HasAppendNonPropertyKeyValues def appendNonPropertyKeyValues(target as HasAppendKeyValue) """ Appends key+value pairs to the target. The pairs further describe the receiver and are not already covered by properties of the receiver. For example implementations, see AssertException and CobraFrame. See also: HasAppendKeyValue """ interface ITreeBuilder inherits HasAppendKeyValue def indent def outdent class DetailedStackTraceAttribute inherits Attribute has AttributeUsage(AttributeTargets(Class, Struct), allowMultiple=false) cue init(flag as bool) base.init _flag = flag get flag from var as bool class MustUseResultAttribute inherits Attribute has AttributeUsage(AttributeTargets.Method, allowMultiple=false) pass class CobraDirectString is extern """ Used internally for assert, require and ensure to encode strings that should not be passed to CobraCore.toTechString. """ cue init(s as String) get string as String return '' class Html """ Represents HTML that doesn't need to be encoded. Html.toString returns the contents as-is. """ cue init(contents as String) base.init _contents = contents get contents from var as String def toString as String is override return _contents interface IHasSourceSite get sourceSite as SourceSite ## For testing enum FB Foo Bar class TestDefaultToString def toString as String is override # return something different than the class name to tease out the different behavior that toTechString exhibits in this case (which is to add the class name to the .toString output) return 'Test Default To String' class NestedToString def toPrintString as String sb = StringBuilder(r'[') sep = '' for row in [[1, 2, 3], [1, 2, 3]] sb.append('[sep][row]') sep = ', ' sb.append(']') return sb.toString class CustomToString def toPrintString as String return '-- to print string --' def toTechString as String return '-- to tech string --' class EnumerableToString implements System.Collections.IEnumerable def getEnumerator as System.Collections.IEnumerator return [1, 2, 3].getEnumerator class BadToString def toString as String is override throw InvalidOperationException('intentional exception in .toString') class BadToTechString def toTechString as String throw InvalidOperationException('intentional exception in .toTechString') class TestAid get protectedTwo as int is protected return 2 get publicThree as int return 3 def testGenMethod1(t as T) pass def testGenMethod2(t as T) as T return t shared def testGenMethod3(t as T) pass def testGenMethod4(t as T) as T return t