@@ -91,7 +91,7 @@ namespace crates::layout2
9191
9292 protected:
9393 virtual std::optional<T> parse (const std::string &input) = 0;
94- virtual std::string stringify () { return " " ; }
94+ virtual std::string stringify () const { return " " ; }
9595
9696 protected:
9797 T handle_;
@@ -438,7 +438,9 @@ namespace crates::layout2
438438#undef XX
439439 return std::nullopt ;
440440 }
441- std::string stringify () override
441+
442+ public:
443+ std::string stringify () const override
442444 {
443445 switch (this ->handle_ )
444446 {
@@ -451,8 +453,6 @@ namespace crates::layout2
451453 return " " ;
452454 }
453455 }
454-
455- public:
456456 friend std::ostream &operator <<(std::ostream &os, const T &value)
457457 {
458458 return os << value.stringify ();
@@ -478,7 +478,9 @@ namespace crates::layout2
478478 return holocron::layout::AlignSelf::Auto;
479479 return BoxAlignmentProperty::parse (input);
480480 }
481- std::string stringify () override
481+
482+ public:
483+ std::string stringify () const override
482484 {
483485 if (handle_ == holocron::layout::AlignSelf::Auto)
484486 return " auto" ;
@@ -971,18 +973,42 @@ namespace crates::layout2
971973 public:
972974 friend std::ostream &operator <<(std::ostream &os, const LayoutStyle &style)
973975 {
974- os << " LayoutStyle {" << std::endl;
975- os << " display: " << style.display () << " ," << std::endl;
976- os << " boxSizing: " << style.boxSizing () << " ," << std::endl;
977- os << " overflowX: " << style.overflow ().x () << " ," << std::endl;
978- os << " overflowY: " << style.overflow ().y () << " ," << std::endl;
979- os << " position: " << style.position () << " ," << std::endl;
980- os << " size: " << " (" << style.width () << " , " << style.height () << " )," << std::endl;
981- os << " [min]size: " << " (" << style.minWidth () << " , " << style.minHeight () << " )," << std::endl;
982- os << " [max]size: " << " (" << style.maxWidth () << " , " << style.maxHeight () << " )," << std::endl;
983- os << " margin: " << style.margin () << " ," << std::endl;
984- os << " padding: " << style.padding () << " ," << std::endl;
985- os << " }" ;
976+ std::ostringstream flex_descriptor;
977+ flex_descriptor << " direction=" << style.flexDirection ()
978+ << " , wrap=" << style.flexWrap ()
979+ << " , basis=" << style.flexBasis ()
980+ << " , grow=" << style.flexGrow ()
981+ << " , shrink=" << style.flexShrink ();
982+
983+ os << " LayoutStyle {" << std::endl
984+ << " display: " << style.display () << std::endl
985+ << " box-sizing: " << style.boxSizing () << std::endl
986+ << " overflow-x: " << style.overflow ().x () << std::endl
987+ << " overflow-y: " << style.overflow ().y () << std::endl
988+ << " position: " << style.position () << std::endl
989+ << " size: " << " (" << style.width () << " , " << style.height () << " )" << std::endl
990+ << " [min]size: " << " (" << style.minWidth () << " , " << style.minHeight () << " )" << std::endl
991+ << " [max]size: " << " (" << style.maxWidth () << " , " << style.maxHeight () << " )" << std::endl
992+ << " margin: " << style.margin () << std::endl
993+ << " padding: " << style.padding () << std::endl
994+ << " border: " << style.border () << std::endl
995+ << " flex: " << flex_descriptor.str () << std::endl
996+ << " align-items: " << style.alignItems () << std::endl
997+ << " align-self: " << style.alignSelf () << std::endl
998+ << " align-content: " << style.alignContent () << std::endl
999+ << " justify-items: " << style.justifyItems () << std::endl
1000+ << " justify-self: " << style.justifySelf () << std::endl
1001+ << " justify-content: " << style.justifyContent () << std::endl
1002+ << " grid-template-rows: " << std::string (style.style_ .gridAutoColumns ) << std::endl
1003+ << " grid-template-columns: " << std::string (style.style_ .gridTemplateColumns ) << std::endl
1004+ << " grid-auto-rows: " << std::string (style.style_ .gridAutoRows ) << std::endl
1005+ << " grid-auto-columns: " << std::string (style.style_ .gridAutoColumns ) << std::endl
1006+ << " grid-auto-flow: " << std::string (style.style_ .gridAutoFlow ) << std::endl
1007+ << " grid-row-start: " << std::string (style.style_ .gridRowStart ) << std::endl
1008+ << " grid-row-end: " << std::string (style.style_ .gridRowEnd ) << std::endl
1009+ << " grid-column-start: " << std::string (style.style_ .gridColumnStart ) << std::endl
1010+ << " grid-column-end: " << std::string (style.style_ .gridColumnEnd ) << std::endl
1011+ << " }" ;
9861012 return os;
9871013 }
9881014 operator holocron::layout::Style () const { return style_; }
0 commit comments