-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vaev-style: Implemented most flex related properties.
- Loading branch information
1 parent
e5636b7
commit 5e41f23
Showing
7 changed files
with
261 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
#include "length.h" | ||
#include "percent.h" | ||
|
||
namespace Vaev { | ||
|
||
struct Width { | ||
enum struct Type { | ||
AUTO, | ||
VALUE, | ||
}; | ||
|
||
using enum Type; | ||
|
||
Type type = Type::VALUE; | ||
PercentOr<Length> value; | ||
|
||
constexpr Width() | ||
: Width(Percent{}) { | ||
} | ||
|
||
constexpr Width(Type type) | ||
: type(type) { | ||
} | ||
|
||
constexpr Width(PercentOr<Length> percent) | ||
: type(Type::VALUE), value(percent) { | ||
} | ||
|
||
constexpr Width(Length length) | ||
: type(Type::VALUE), value(length) { | ||
} | ||
|
||
void repr(Io::Emit &e) const { | ||
if (type == Type::AUTO) { | ||
e("auto"); | ||
} else { | ||
e("{}", value); | ||
} | ||
} | ||
|
||
bool operator==(Type t) const { | ||
return type == t; | ||
} | ||
}; | ||
|
||
} // namespace Vaev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#pragma once | ||
|
||
#include <karm-base/std.h> | ||
#include <karm-io/emit.h> | ||
|
||
namespace Vaev { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.