void FStabilityEventLogger::Log(EEventLog::Type Event, const FString& AdditionalContent, TSharedPtr<SWidget> Widget) { // filter out events that happen a lot if (Event == EEventLog::MouseMove || Event == EEventLog::MouseEnter || Event == EEventLog::MouseLeave || Event == EEventLog::DragEnter || Event == EEventLog::DragLeave || Event == EEventLog::DragOver) { return; } if (Widget.IsValid()) { LoggedEvents.Add(PrettyPrint(Event, AdditionalContent, Widget)); } else { LoggedEvents.Add(PrettyPrint(Event, AdditionalContent)); } if (LoggedEvents.Num() > STABILITY_LOG_MAX_SIZE) { LoggedEvents.RemoveAt(0, LoggedEvents.Num() - STABILITY_LOG_MAX_SIZE); } }
inline std::string PrettyPrint(const std::vector<T, Allocator>& vectoprint, const bool add_delimiters=false, const std::string& separator=", ") { std::ostringstream strm; if (vectoprint.size() > 0) { if (add_delimiters) { strm << "[" << PrettyPrint(vectoprint[0], add_delimiters, separator); for (size_t idx = 1; idx < vectoprint.size(); idx++) { strm << separator << PrettyPrint(vectoprint[idx], add_delimiters, separator); } strm << "]"; } else { strm << PrettyPrint(vectoprint[0], add_delimiters, separator); for (size_t idx = 1; idx < vectoprint.size(); idx++) { strm << separator << PrettyPrint(vectoprint[idx], add_delimiters, separator); } } } return strm.str(); }
void PrettyPrint(NodeTree* root, int val) { if (root==NULL) return; PrettyPrint(root->right, val+4); int i; for (i=0; i<val; i++) { printf(" "); } printf("%s\n", root->data); PrettyPrint(root->left, val+4); }
inline std::string PrettyPrint(const std::pair<A, B>& pairtoprint, const bool add_delimiters=false, const std::string& separator=", ") { std::ostringstream strm; if (add_delimiters) { strm << "<" << PrettyPrint(pairtoprint.first, add_delimiters, separator) << ": " << PrettyPrint(pairtoprint.second, add_delimiters, separator) << ">"; } else { strm << PrettyPrint(pairtoprint.first, add_delimiters, separator) << ": " << PrettyPrint(pairtoprint.second, add_delimiters, separator); } return strm.str(); }
//----------------------------------------------------------------// STLString MOAISim::ToString () { STLString repr; const char *timer_state; switch ( mTimerState ) { case PAUSED: timer_state = "paused"; break; case RESUMING: timer_state = "resuming"; break; case RUNNING: timer_state = "running"; break; default: timer_state = "INVALID"; } PrettyPrint ( repr, "mTimerState", timer_state ); PRETTY_PRINT ( repr, mTime ) PRETTY_PRINT ( repr, mDeviceTime ) return repr; }
void FFileEventLogger::Log(EEventLog::Type Event, const FString& AdditionalContent, TSharedPtr<SWidget> Widget) { if (Widget.IsValid()) { LoggedEvents.Add( PrettyPrint(Event, AdditionalContent, Widget) ); } }
void PrettyPrint(Heap * h) { Heap * h1; if(h == NULL_HEAP) { printf(" nil "); return; } printf("("); h1 = h; do { PrintItem(ITEM(h1)); printf("[%u] ", RANK(h1)); PrettyPrint(CHILD(h1)); h1 = FORWARD(h1); } while(h1 != h); printf(")"); }
int main() { NodeTree* root=CreateBinaryTree(); // NodeList* FirstFromList=GetListFromTree(root); // TraverseList(FirstFromList); // root=GetTreeFromList(FirstFromList); PrettyPrint(root,0); return 0; }
inline std::string PrettyPrint(const std::unordered_multimap<A, B, Hash, Predicate, Allocator>& maptoprint, const bool add_delimiters=false, const std::string& separator=", ") { std::ostringstream strm; if (maptoprint.size() > 0) { if (add_delimiters) { strm << "{"; typename std::unordered_multimap<A, B, Hash, Predicate, Allocator>::const_iterator itr; for (itr = maptoprint.begin(); itr != maptoprint.end(); ++itr) { std::pair<A, B> cur_pair(itr->first, itr->second); if (itr != maptoprint.begin()) { strm << separator << PrettyPrint(cur_pair, add_delimiters, separator); } else { strm << PrettyPrint(cur_pair, add_delimiters, separator); } } strm << "}"; } else { typename std::unordered_multimap<A, B, Hash, Predicate, Allocator>::const_iterator itr; for (itr = maptoprint.begin(); itr != maptoprint.end(); ++itr) { std::pair<A, B> cur_pair(itr->first, itr->second); if (itr != maptoprint.begin()) { strm << separator << PrettyPrint(cur_pair, add_delimiters, separator); } else { strm << PrettyPrint(cur_pair, add_delimiters, separator); } } } } return strm.str(); }
// Prints shaders one line at the time. This ensures they don't get truncated by the adb log. void PrintLineByLine(const char* header, const SkSL::String& text) { if (header) { SkDebugf("%s\n", header); } SkSL::String pretty = PrettyPrint(text); SkTArray<SkString> lines; SkStrSplit(pretty.c_str(), "\n", kStrict_SkStrSplitMode, &lines); for (int i = 0; i < lines.count(); ++i) { SkDebugf("%4i\t%s\n", i + 1, lines[i].c_str()); } }
double* CLinearSystem::Solve() { printf("system to solve: \n"); PrettyPrint(); printf("==== solving ==== \n"); Normalize(); Augment(); Reduce(); Augment(); PrettyPrint(); if(m_result != NULL) { delete m_result; } m_result = new double[m_n]; for(int n = 0; n < m_n; n++) { m_result[n] = Get(n,m_m-1); } return m_result; }
inline std::string PrettyPrint(const std::unordered_multiset<T, Hash, Predicate, Allocator>& settoprint, const bool add_delimiters=false, const std::string& separator=", ") { std::ostringstream strm; if (settoprint.size() > 0) { if (add_delimiters) { strm << "("; typename std::unordered_multiset<T, Hash, Predicate, Allocator>::const_iterator itr; for (itr = settoprint.begin(); itr != settoprint.end(); ++itr) { if (itr != settoprint.begin()) { strm << separator << PrettyPrint(*itr, add_delimiters, separator); } else { strm << PrettyPrint(*itr, add_delimiters, separator); } } strm << ")"; } else { typename std::unordered_multiset<T, Hash, Predicate, Allocator>::const_iterator itr; for (itr = settoprint.begin(); itr != settoprint.end(); ++itr) { if (itr != settoprint.begin()) { strm << separator << PrettyPrint(*itr, add_delimiters, separator); } else { strm << PrettyPrint(*itr, add_delimiters, separator); } } } } return strm.str(); }
inline std::string PrettyPrint(const std::deque<T, Allocator>& dequetoprint, const bool add_delimiters=false, const std::string& separator=", ") { std::ostringstream strm; if (dequetoprint.size() > 0) { if (add_delimiters) { strm << "["; typename std::deque<T, Allocator>::const_iterator itr; for (itr = dequetoprint.begin(); itr != dequetoprint.end(); ++itr) { if (itr != dequetoprint.begin()) { strm << separator << PrettyPrint(*itr, add_delimiters, separator); } else { strm << PrettyPrint(*itr, add_delimiters, separator); } } strm << "]"; } else { typename std::deque<T, Allocator>::const_iterator itr; for (itr = dequetoprint.begin(); itr != dequetoprint.end(); ++itr) { if (itr != dequetoprint.begin()) { strm << separator << PrettyPrint(*itr, add_delimiters, separator); } else { strm << PrettyPrint(*itr, add_delimiters, separator); } } } } return strm.str(); }
void PrintUsage(bool fSummaryUsage) { size_t width = GetConsoleWidth(); const char* psz = fSummaryUsage ? stunclient_lite_text : stunclient_text; // save some margin space if (width > 2) { width -= 2; } PrettyPrint(psz, width); }
void FConsoleEventLogger::Log( EEventLog::Type Event, const FString& AdditionalContent, TSharedPtr<SWidget> Widget ) { UE_LOG(LogSlate, Log, TEXT("%s"), *PrettyPrint(Event, AdditionalContent, Widget)); }
int main() { // The number that the variable "x" will point to double_complex x; // Creates a variable named "x" and which value will be x CVar xvar ( "x" , &x ); // Asks for a fomula depending on the variable x, e.g. "sin 2x" char s[500]=""; printf("Enter a formula depending on the variable x:\n"); gets(s); // Creates an operation with this formula. The operation depends on one // variable, which is xvar ; the third argument is an array of pointers // to variables; the previous argument is its size CVar* vararray[1]; vararray[0]=&xvar; COperation op ( s, 1, vararray ); // Affects (indirectly) a value to xvar x=3; // Printfs the value of the formula for x=3; printf("%s = %s for x=3\n\n", op.Expr(), PrettyPrint(op.Val()) ); // Creates a function name which can be used in later functions to refer to the operation op(x) CFunction f (op, &xvar); f.SetName("f"); // Creates a second variable named y, and a formula depending on both x and y double_complex y; CVar yvar ( "y" , &y ); CVar* vararray2[2]; // table of variables containing the adresses of xvar and yvar vararray2[0]=&xvar; vararray2[1]=&yvar; // Asks for a formula using x, y and the already-defined function f, e.g. x+f(3y) printf("Enter a formula using x, y and the function f(x): x -> %s that you just entered, e.g. x+f(3y) :\n", op.Expr()); gets(s); CFunction* funcarray[1]; funcarray[0]=&f; COperation op2 ( (char*)s , 2 , vararray2 , 1, funcarray ); // vararray2 is a CVar* array with two elements // funcarray is a CFunction* array with one element y=5; printf("Value for x=3, y=5 : %s\n", PrettyPrint(op2.Val()) ); // Turns the last expression into a function of x and y CFunction g(op2, 2, vararray2); g.SetName("g"); // Here is another way to do it double_complex z,t; CVar zvar("z", &z), tvar("t", &t); COperation op3,zop,top; zop=zvar; top=tvar; // constructs, from a variable, the operation returning its value op3=g( (zop+top, top^2) ); // Ready-to-use ; needs two pairs of ( ) // Now op3 contains the operation op2 with x replaced with z+t, and y replaced with t^2 z=5;t=7; printf("\nLet g be the function g : x,y -> %s\n", op2.Expr()); printf("Value of %s for z=5,t=7:\n %s\n", op3.Expr(), PrettyPrint(op3.Val()) ); COperation dopdt=op3.Diff(tvar); // Computes the derivative of op3 w.r.t t printf("Value of d/dt (g(z+t,t^2)) = %s for z=5,t=7:\n %s\n", dopdt.Expr(), PrettyPrint(dopdt.Val()) ); COperation dopdtbar=op3.DiffConj(tvar); // Computes the derivative of op3 w.r.t the conjugate of t printf("Value of d/dtbar (g(z+t,t^2)) = %s for z=5,t=7:\n %s\n", dopdtbar.Expr(), PrettyPrint(dopdtbar.Val()) ); return 0; }
std::string Hotkey::PrettyPrint() const { return PrettyPrint(m_key, m_mod_keys); }