跳到內容

standardexceptions

本頁內容尚未翻譯。

record StandardException

A standard exception class: its name (after std::), its base’s (none for std::exception), and what()’s fixed text (none for a class that keeps its message, and one derived from it).

def StandardException.of (name : String) (base : Option String) (fixed : Option String) : StandardException

A standard exception class from its parts.

def StandardExceptions.all : List StandardException

The standard exception classes, each after its base, as libc++ defines them.

def StandardExceptions.className (x : String) : String

A standard exception’s class name.

def StandardExceptions.classType (x : String) : TypeSyntax

A standard exception’s class as a written type.

def StandardExceptions.isClass (x : String) : Bool

Whether a name is a standard exception class’s.

def StandardExceptions.message : String

The member that keeps a message.

def StandardExceptions.copyName : String

The function that copies a message into a block of its own (new[]), what a message is kept in.

def StandardExceptions.copyFunction : Item

char *#copyMessage(const char *text): a block of strlen(text) + 1 characters (new[]) with the text and its null copied.

def StandardExceptions.keeper (fuel : Nat) (x : String) : String

The class that keeps the message an exception class (derived from it) is constructed with: logic_error or runtime_error (fuel bounds the depth).

def StandardExceptions.keeping (x : String) (what : Expr -> Member) : List Member

The members of the class (named x) that keeps a message, as libc++ keeps it (a copy of its own, not a std::string): the message’s block, a copy constructor and a copy assignment that copy it, a destructor that releases it, and what() that gives it.

def StandardExceptions.classOf (strings : Bool) (e : StandardException) : Item

A standard exception’s class. One with a fixed text has a default constructor and that what(); one that keeps its message is constructed from a C string (and from a std::string, in a program that has them): the keeper (logic_error, runtime_error) copies it, a class derived from one gives it to its base and inherits the keeper’s what().

def Item.usesString (items : List Item) : Bool

Whether a program’s items use std::string (the syntax’s string type, or the library’s class).

def StandardExceptions.used (e : Expr) : List String

The standard exceptions an expression uses: one it constructs, std::out_of_range for a call of at or substr (std::vector’s and std::string’s throw it), std::bad_cast for a dynamic_cast to a reference (it throws one where it fails), std::bad_typeid for typeid of an expression.

def StandardExceptions.typeNames (t : TypeSyntax) : List String

The standard exception a written type names, if any.

def StandardExceptions.derived (it : Item) : List String

The standard exceptions a class derives from directly.

def StandardExceptions.mentioned (items : List Item) : List String

The standard exceptions a program’s items use: by type, as a base, or by an expression (one pass over them).

def StandardExceptions.baseOf (x : String) : List String

A standard exception’s base (none for std::exception, or a name that is not one).

def StandardExceptions.withBases (fuel : Nat) (names : List String) : List String

The names with their bases, and theirs (fuel bounds the depth).

def StandardExceptions.needed (items : List Item) : List StandardException

The standard exception classes a program needs: those it uses and their bases, each after its base.

def StandardExceptions.rewrite (t : TypeSyntax) : TypeSyntax

A written type with a standard exception’s replaced by its class.

def StandardExceptions.prepare (p : Program) : Program

A program with the standard exception classes it needs before its items.