diff --git a/LICENSE b/LICENSE index 5c00ae3..22e5c21 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,7 @@ +Better Enums is distributed under the terms of the 2-clause BSD license. Its +text is given below. + + Copyright (c) 2012-2015, Anton Bachin All rights reserved. @@ -21,3 +25,44 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + + + +Better Enums uses the mistune library as part of its documentation generator. +Its web address and license are given below. + + +http://mistune.readthedocs.org/en/latest/ + + +Copyright (c) 2014 - 2015, Hsiaoming Yang + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this +list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +* Neither the name of the creator nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior +written permission. + + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/doc/DesignDecisionsFAQ.md b/doc/DesignDecisionsFAQ.md index 188b423..674b724 100644 --- a/doc/DesignDecisionsFAQ.md +++ b/doc/DesignDecisionsFAQ.md @@ -52,8 +52,6 @@ interesting option, and it has [its own section][traits]. I have tried it, but the verbosity increase is much greater than the benefit of dropping underscores, so I chose not to do it. -%% description = Better Enums design decisions and tradeoffs. - ### Why does Better Enums use a macro at all? Better Enums needs to turn the names of declared constants into strings, and I @@ -248,3 +246,5 @@ generation. [underlying]: ${prefix}demo/NonIntegralUnderlyingTypes.html [traits-branch]: $repo/tree/traits [traits-samples]: $repo/tree/traits/samples + +%% description = Better Enums design decisions and tradeoffs. diff --git a/doc/Makefile b/doc/Makefile index 758c612..d16fcd8 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,12 +1,23 @@ SOURCE_MARKDOWN := $(wildcard tutorial/*) $(wildcard demo/*) SOURCE_CXX := $(SOURCE_MARKDOWN:.md=.cc) -.PHONY : all -all : html examples - .PHONY : html html : python docs.py + @echo "See html/index.html" + +.PHONY : publish +publish : prepare + cp -r html ../doc-publish + git commit --amend + git push -f + +.PHONY : prepare +prepare : examples web + +.PHONY : web +web : examples + python docs.py --web .PHONY : examples examples : clean-examples $(SOURCE_CXX) diff --git a/doc/better-enums.css b/doc/better-enums.css index d585746..f9ca9bf 100644 --- a/doc/better-enums.css +++ b/doc/better-enums.css @@ -122,7 +122,6 @@ header { background: linear-gradient(#395E7E, #4A79A0); color: white; padding: 50px 0; - margin-bottom: 50px; } h1 { @@ -226,12 +225,12 @@ footer { a { text-decoration: none; color: white; - background-color: red; + /*background-color: red;*/ } a[href=""] { color: white !important; - background-color: red !important; + /*background-color: red !important;*/ } a:hover { @@ -242,6 +241,10 @@ header a:hover { text-decoration: none; } +.main { + margin-top: 50px; +} + .main a[href], footer a[href] { background-color: #edd; color: #844; @@ -545,3 +548,32 @@ h3.contents { margin-top: 0; padding-bottom: 1em; } + +.buttons-bar { + background-color: #f4f4f4; + padding-top: 0.5em; + padding-bottom: 0.5em; + height: 20px; +} + +.buttons-bar a img { + margin-right: 25px; +} + +.buttons-bar iframe.gh-button { + width: 95px; +} + +.buttons-bar .tweet-share, +.buttons-bar .gh-button { + display: none; +} + +.index .buttons-bar .tweet-share, +.index .buttons-bar .gh-button { + display: initial; +} + +.buttons-bar iframe.gh-watch { + width: 103px; +} diff --git a/doc/demo/102-any-underlying.md b/doc/demo/102-any-underlying.md index 46f8efc..870a74a 100644 --- a/doc/demo/102-any-underlying.md +++ b/doc/demo/102-any-underlying.md @@ -7,7 +7,15 @@ between `T` and an integral type of your choosing. This also works in $cxx98 doesn't have to be `constexpr`. In $cxx98, everything involving `T` will simply be done by Better Enums at run time. -Here's how to do it. +This feature is semi-experimental. I am considering relaxing the requirements on +`T` so that it doesn't have to be literal. I can use a `reinterpret_cast` to +make a mapping automatically. This will make non-integral underlying types +easier to use, but will also prevent usage at compile time, which unfortunately +has structural consequences for the implementation of Better Enums, and +additional semantic consequences for usage, even at run time. + +In the meantime, here's how to have a non-integral underlying type in the +current version. #include #include diff --git a/doc/docs.py b/doc/docs.py index 8f015f0..36c49e3 100755 --- a/doc/docs.py +++ b/doc/docs.py @@ -7,6 +7,8 @@ import string import transform import os import os.path +import sys +import urllib TEMPLATE_DIRECTORY = "template" OUTPUT_DIRECTORY = "html" @@ -83,6 +85,9 @@ def compose_page(relative_path, definitions): definitions["canonical"] = canonical definitions["prefix"] = prefix + definitions["quoted_url"] = urllib.quote(definitions["canonical"], "") + definitions["quoted_title"] = urllib.quote(definitions["title"], "") + if "class" not in definitions: definitions["class"] = "" @@ -202,6 +207,9 @@ def generate_sitemap(): def main(): load_templates() + if not (len(sys.argv) >= 2 and sys.argv[1] == "--web"): + templates["ga"] = "" + remove_output_directory() process_threaded(TUTORIAL_DIRECTORY) @@ -212,6 +220,8 @@ def main(): compose_general_page(page) copy_static_file("better-enums.css") + copy_static_file("image/twsupport.png") + copy_static_file("image/tweet.png") generate_sitemap() diff --git a/doc/image/tweet.png b/doc/image/tweet.png new file mode 100644 index 0000000..dbbd61d Binary files /dev/null and b/doc/image/tweet.png differ diff --git a/doc/image/twsupport.png b/doc/image/twsupport.png new file mode 100644 index 0000000..ddc4b1f Binary files /dev/null and b/doc/image/twsupport.png differ diff --git a/doc/index.md b/doc/index.md index 9bdb7e8..7c53d94 100644 --- a/doc/index.md +++ b/doc/index.md @@ -61,23 +61,23 @@ Channel c = Channel::_from_integral(3); reflective enum types.

-That means you can easily convert enums to and from strings, -validate them, and loop over them. In $cxx11, you can do it all at +That means you can easily convert enums to and from strings, +validate them, and loop over them. In $cxx11, you can do it all at compile time. It's what built-in enums ought to support. Better Enums simply adds the missing features. And, it is based on the best known techniques, thoroughly tested, fast, portable, and documented exhaustively. -All you have to do to use it is include enum.h. +To use it, just include enum.h. Try it live online in -[Wandbox](http://melpon.org/wandbox/permlink/pdlAAGoxnjqG6FRI), or begin the +[Wandbox](http://melpon.org/wandbox/permlink/wICNzu2LW2vEgqzh), or begin the [tutorial](${prefix}tutorial/HelloWorld.html)!
-### Features +### Highlights