Skip to content

Commit

Permalink
Provide forward declaration of <</>> operators
Browse files Browse the repository at this point in the history
Don't only define these methods in the friend declaration
  • Loading branch information
alastair committed Mar 19, 2020
1 parent 3914082 commit a456739
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 50 deletions.
22 changes: 12 additions & 10 deletions src/dataset.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
/*
* Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
*
* This file is part of Gaia
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 of the License, or (at your
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 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
*
* 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.
*
*
* You should have received a copy of the Affero GNU General Public License
* version 3 along with this program. If not, see http://www.gnu.org/licenses/
*/
Expand Down Expand Up @@ -488,6 +488,8 @@ class DataSet : public PointArray, public QObject {

};

QDataStream& operator<<(QDataStream& out, const DataSet& dataset);
QDataStream& operator>>(QDataStream& in, DataSet& dataset);

} // namespace gaia2

Expand Down
22 changes: 12 additions & 10 deletions src/descriptortree.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
/*
* Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
*
* This file is part of Gaia
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 of the License, or (at your
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 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
*
* 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.
*
*
* You should have received a copy of the Affero GNU General Public License
* version 3 along with this program. If not, see http://www.gnu.org/licenses/
*/
Expand Down Expand Up @@ -313,6 +313,8 @@ class DescriptorTree {
friend QDataStream& operator>>(QDataStream& in, DescriptorTree& tree);
};

QDataStream& operator<<(QDataStream& out, const DescriptorTree& tree);
QDataStream& operator>>(QDataStream& in, DescriptorTree& tree);

} // namespace gaia2

Expand Down
25 changes: 15 additions & 10 deletions src/point.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
/*
* Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
*
* This file is part of Gaia
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 of the License, or (at your
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 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
*
* 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.
*
*
* You should have received a copy of the Affero GNU General Public License
* version 3 along with this program. If not, see http://www.gnu.org/licenses/
*/
Expand Down Expand Up @@ -69,6 +69,9 @@ class Scope {
friend QDataStream& operator>>(QDataStream& in, Scope& scope);
};

QDataStream& operator<<(QDataStream& out, const Scope& scope);
QDataStream& operator>>(QDataStream& in, Scope& scope);

class ScopedData {
public:
Scope scope;
Expand Down Expand Up @@ -309,6 +312,8 @@ class Point {
friend QDataStream& operator>>(QDataStream& in, Point& point);
};

QDataStream& operator<<(QDataStream& out, const Point& point);
QDataStream& operator>>(QDataStream& in, Point& point);

// some useful defines that will be used in lots of places
#define FORSEG(p) for (int nseg=0; nseg<(p).numberSegments(); nseg++)
Expand Down
23 changes: 13 additions & 10 deletions src/pointlayout.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
/*
* Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
*
* This file is part of Gaia
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 of the License, or (at your
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 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
*
* 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.
*
*
* You should have received a copy of the Affero GNU General Public License
* version 3 along with this program. If not, see http://www.gnu.org/licenses/
*/
Expand Down Expand Up @@ -324,6 +324,9 @@ class PointLayout {

};

QDataStream& operator<<(QDataStream& out, const PointLayout& layout);
QDataStream& operator>>(QDataStream& in, PointLayout& layout);

} // namespace gaia2

#endif // GAIA_POINTLAYOUT_H
22 changes: 12 additions & 10 deletions src/region.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
/*
* Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
*
* This file is part of Gaia
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 of the License, or (at your
*
* Gaia is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation (FSF), either version 3 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
*
* 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.
*
*
* You should have received a copy of the Affero GNU General Public License
* version 3 along with this program. If not, see http://www.gnu.org/licenses/
*/
Expand Down Expand Up @@ -117,6 +117,8 @@ class Segment {
friend QDataStream& operator>>(QDataStream& in, Segment& segment);
};

QDataStream& operator<<(QDataStream& out, const Segment& segment);
QDataStream& operator>>(QDataStream& in, Segment& segment);

/**
* A region is a physical location in the point layout which consists in a list
Expand Down

0 comments on commit a456739

Please sign in to comment.