Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::ExternalValueBase Class Referenceabstract

#include <value.hh>

Public Member Functions

virtual std::string showType () const =0
virtual std::string typeOf () const =0
virtual std::string coerceToString (EvalState &state, const PosIdx &pos, NixStringContext &context, bool copyMore, bool copyToStore) const
virtual bool operator== (const ExternalValueBase &b) const
virtual JSON printValueAsJSON (EvalState &state, bool strict, NixStringContext &context, bool copyToStore=true) const
virtual void printValueAsXML (EvalState &state, bool strict, bool location, XMLWriter &doc, NixStringContext &context, PathSet &drvsSeen, const PosIdx pos) const

Protected Member Functions

virtual std::ostream & print (std::ostream &str) const =0

Friends

class Printer
std::ostream & operator<< (std::ostream &str, const ExternalValueBase &v)

Detailed Description

External values must descend from ExternalValueBase, so that type-agnostic nix functions (e.g. showType) can be implemented

Member Function Documentation

◆ coerceToString()

std::string nix::ExternalValueBase::coerceToString ( EvalState & state,
const PosIdx & pos,
NixStringContext & context,
bool copyMore,
bool copyToStore ) const
virtual

Coerce the value to a string. Defaults to uncoercable, i.e. throws an error.

◆ operator==()

bool nix::ExternalValueBase::operator== ( const ExternalValueBase & b) const
virtual

Compare to another value of the same type. Defaults to uncomparable, i.e. always false.

◆ print()

virtual std::ostream & nix::ExternalValueBase::print ( std::ostream & str) const
protectedpure virtual

Print out the value

◆ printValueAsJSON()

JSON nix::ExternalValueBase::printValueAsJSON ( EvalState & state,
bool strict,
NixStringContext & context,
bool copyToStore = true ) const
virtual

Print the value as JSON. Defaults to unconvertable, i.e. throws an error

◆ printValueAsXML()

void nix::ExternalValueBase::printValueAsXML ( EvalState & state,
bool strict,
bool location,
XMLWriter & doc,
NixStringContext & context,
PathSet & drvsSeen,
const PosIdx pos ) const
virtual

Print the value as XML. Defaults to unevaluated

◆ showType()

virtual std::string nix::ExternalValueBase::showType ( ) const
pure virtual

Return a simple string describing the type

◆ typeOf()

virtual std::string nix::ExternalValueBase::typeOf ( ) const
pure virtual

Return a string to be used in builtins.typeOf


The documentation for this class was generated from the following files:
  • lix/libexpr/value.hh
  • lix/libexpr/eval.cc
  • lix/libexpr/value-to-json.cc
  • lix/libexpr/value-to-xml.cc