GithubHelp home page GithubHelp logo

bouml-smartptr's Introduction

bouml-smartptr

A BOUML plug-out for using c++11 smart-pointers in UML relations

Usage

Build the plug-out

Open plugout-smartptr.prj in BOUML, you just have to generate for C++ (tools > Generate C++, or ctrl+G). The code will be put under plugout-smartptr/cpp. Then you need to generate to .pro file. In the BOUML project, find the artifact named executable (use Ctrl+F to search). Right-click on it, then "Tool > Generate .pro". Change the paths to wherever you want to (the default /tmp/ not a good idea). Click OK, and in a terminal go where the files where generated. Just run qmake && make. If all the dependencies are ok, you now have the plugout executable.

Import the profile

Now open your own project, and import the smartptr-profile.prj project, which will give you access to the new stereotypes for UML Relations: right-click on your top-level project > Import Project. You also need to set the path to the plugout. In Tools > Tools Settings > Class, add a tool with the path to your freshly built plugout, and name it "C++ smart_ptr" (I don't if the name's actually important).

Set-up generation options

Last thing to do is to tell the generator which includes are needed for your stereotypes. In your top-level package Generation Settings > Stereotypes > attribute and relations stereotypes correspondance, add the following lines:

Uml C++
smart_ptr:shared_ptr std::shared_ptr
smart_ptr:weak_ptr std::weak_ptr
smart_ptr:unique_ptr std::unique_ptr

And in the tab C++ [5] > External Types:

External Type Include etc...
std::shared_ptr #include <memory>
std::weak_ptr #include <memory>
std::unique_ptr #include <memory>
smart_ptr:vector_shared #include <memory>
#include <vector>
smart_ptr:vector_weak #include <memory>
#include <vector>

Use it

Now when you create a relation between classes, you can select stereotypes that will create either:

std::shared_ptr<T> x;
std::weak_ptr<T> x;
std::unique_ptr<T> x;
std::vector<std::shared_ptr<T> > x;
std::vector<std::weak_ptr<T> > x;

Hope you enjoy!

License

All the contents of this repository is licensed under the GNU General Public License (GPL)

Copyright (C) 2018  Jules Waldhart
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

See the LICENSE file containing a copy of the GNU General Public
License for more details.

bouml-smartptr's People

Contributors

juleswh avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.