Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support describing concepts in source-to-asciidoc transfomation #675

Open
akrzemi1 opened this issue Sep 27, 2024 · 4 comments
Open

Support describing concepts in source-to-asciidoc transfomation #675

akrzemi1 opened this issue Sep 27, 2024 · 4 comments
Assignees

Comments

@akrzemi1
Copy link
Contributor

My current documentation (which I create manually) provides the definition of the concept, and then, for every constraint, a description is provided:
https://github.com/akrzemi1/markable/blob/master/documentation/reference.adoc#concept-mark_policy

Does something like this works, or could be made to work, in mrdocs?

@alandefreitas
Copy link
Collaborator

@akrzemi1 akrzemi1 changed the title Allow describing concepts Support describing concepts in source-to-asciidoc transfomation Sep 28, 2024
@alandefreitas alandefreitas moved this to Accepted in MrDocs Sep 30, 2024
@akrzemi1
Copy link
Contributor Author

Will the following concept definition and annotations be documented?

/** Requirements on a mark policy

  @tparam MP mark policy 
 */
template <typename MP>
concept mark_policy =
  requires
  {
    /// type of the _logical value_
    typename MP::value_type;
    /// type of the value used for the actual storage
    typename MP::storage_type;
    /// type used for the return type of `markable::value()`
    typename MP::reference_type;
    /// type of the _representation value_
    typename MP::representation_type;
  } &&
  requires(const typename MP::representation_type &  cr,
                 typename MP::representation_type && rr,
           const typename MP::storage_type &         s,
           const typename MP::value_type &           cv,
                 typename MP::value_type &&          rv)
  {
    /// Returns the representation value representing a marked value
    { MP::marked_value() }
      -> ::std::convertible_to<typename MP::representation_type>;
    /// Checks if the representation value represents a marked value
    { MP::is_marked_value(cr) }
      -> ::std::convertible_to<bool>;

    /** Given a value of the storage type, provides access to the logical value
    
      @pre: `!MP::is_marked_value(MP::representation(s))` is `true`.
      */
    { MP::access_value(s) }
      -> ::std::same_as<typename MP::reference_type>;
    /// Given a value of the storage type, provides access to the representation value
    { MP::representation(s) }
      -> ::std::same_as<const typename MP::representation_type &>;
    /// Encodes the provided logical value in the storage type
    { MP::store_value(cv) }
      -> ::std::convertible_to<typename MP::storage_type>;
    /// Encodes the provided logical value in the storage type
    { MP::store_value(::std::move(rv)) }
      -> ::std::convertible_to<typename MP::storage_type>;
    /// Encodes the provided representation value in the storage type
    { MP::store_representation(cr) }
      -> ::std::convertible_to<typename MP::storage_type>;
    /// Encodes the provided representation value in the storage type
    { MP::store_representation(::std::move(rr)) }
      -> ::std::convertible_to<typename MP::storage_type>;
  };

@alandefreitas
Copy link
Collaborator

alandefreitas commented Sep 30, 2024

I believe it would extract the concepts but only include it in the XML output for now. @sdkrystian ?

@akrzemi1
Copy link
Contributor Author

I mean, the above exmple requires parsing preconditons of a single constraint. It also has two requires-clauses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Accepted
Development

No branches or pull requests

3 participants