Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
0348341f
Kaydet (Commit)
0348341f
authored
Kas 16, 2014
tarafından
Kohei Yoshida
Kaydeden (comit)
Kohei Yoshida
Kas 17, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make these methods non-inline.
Change-Id: I0b24e34dec6c452659b224b45a6849dafe708c3b
üst
07a086fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
101 deletions
+109
-101
fract.hxx
include/tools/fract.hxx
+18
-101
fract.cxx
tools/source/generic/fract.cxx
+91
-0
No files found.
include/tools/fract.hxx
Dosyayı görüntüle @
0348341f
...
@@ -58,112 +58,29 @@ public:
...
@@ -58,112 +58,29 @@ public:
void
ReduceInaccurate
(
unsigned
nSignificantBits
);
void
ReduceInaccurate
(
unsigned
nSignificantBits
);
friend
inline
Fraction
operator
+
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
Fraction
operator
+
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
friend
inline
Fraction
operator
-
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
Fraction
operator
-
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
friend
inline
Fraction
operator
*
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
Fraction
operator
*
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
friend
inline
Fraction
operator
/
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
Fraction
operator
/
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
bool
operator
==
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
bool
operator
==
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
friend
inline
bool
operator
!=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
bool
operator
!=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
bool
operator
<
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
bool
operator
<
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
bool
operator
>
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
bool
operator
>
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
friend
inline
bool
operator
<=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
bool
operator
<=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
friend
inline
bool
operator
>=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
bool
operator
>=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
friend
SvStream
&
ReadFraction
(
SvStream
&
rIStream
,
Fraction
&
rFract
);
TOOLS_DLLPUBLIC
friend
SvStream
&
ReadFraction
(
SvStream
&
rIStream
,
Fraction
&
rFract
);
TOOLS_DLLPUBLIC
friend
SvStream
&
WriteFraction
(
SvStream
&
rOStream
,
const
Fraction
&
rFract
);
TOOLS_DLLPUBLIC
friend
SvStream
&
WriteFraction
(
SvStream
&
rOStream
,
const
Fraction
&
rFract
);
};
};
inline
Fraction
::
Fraction
(
const
Fraction
&
rFrac
)
TOOLS_DLLPUBLIC
Fraction
operator
+
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
{
TOOLS_DLLPUBLIC
Fraction
operator
-
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
valid
=
rFrac
.
valid
;
TOOLS_DLLPUBLIC
Fraction
operator
*
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
if
(
valid
)
TOOLS_DLLPUBLIC
Fraction
operator
/
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
value
.
assign
(
rFrac
.
value
.
numerator
(),
rFrac
.
value
.
denominator
()
);
TOOLS_DLLPUBLIC
bool
operator
!=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
}
TOOLS_DLLPUBLIC
bool
operator
<=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
TOOLS_DLLPUBLIC
bool
operator
>=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
);
inline
long
Fraction
::
GetNumerator
()
const
{
if
(
!
valid
)
{
SAL_WARN
(
"tools.fraction"
,
"'GetNumerator()' on invalid fraction"
);
return
0
;
}
return
value
.
numerator
();
}
inline
long
Fraction
::
GetDenominator
()
const
{
if
(
!
valid
)
{
SAL_WARN
(
"tools.fraction"
,
"'GetDenominator()' on invalid fraction"
);
return
-
1
;
}
return
value
.
denominator
();
}
inline
Fraction
&
Fraction
::
operator
=
(
const
Fraction
&
rFrac
)
{
if
(
this
!=
&
rFrac
)
{
valid
=
rFrac
.
valid
;
if
(
valid
)
value
.
assign
(
rFrac
.
value
.
numerator
(),
rFrac
.
value
.
denominator
()
);
}
return
*
this
;
}
inline
bool
Fraction
::
IsValid
()
const
{
return
valid
;
}
inline
Fraction
::
operator
long
()
const
{
if
(
!
valid
)
{
SAL_WARN
(
"tools.fraction"
,
"'operator long()' on invalid fraction"
);
return
0
;
}
return
boost
::
rational_cast
<
long
>
(
value
);
}
inline
Fraction
operator
+
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
Fraction
aErg
(
rVal1
);
aErg
+=
rVal2
;
return
aErg
;
}
inline
Fraction
operator
-
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
Fraction
aErg
(
rVal1
);
aErg
-=
rVal2
;
return
aErg
;
}
inline
Fraction
operator
*
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
Fraction
aErg
(
rVal1
);
aErg
*=
rVal2
;
return
aErg
;
}
inline
Fraction
operator
/
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
Fraction
aErg
(
rVal1
);
aErg
/=
rVal2
;
return
aErg
;
}
inline
bool
operator
!=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
return
!
(
rVal1
==
rVal2
);
}
inline
bool
operator
<=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
return
!
(
rVal1
>
rVal2
);
}
inline
bool
operator
>=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
return
!
(
rVal1
<
rVal2
);
}
#endif
#endif
...
...
tools/source/generic/fract.cxx
Dosyayı görüntüle @
0348341f
...
@@ -191,6 +191,97 @@ void Fraction::ReduceInaccurate( unsigned nSignificantBits )
...
@@ -191,6 +191,97 @@ void Fraction::ReduceInaccurate( unsigned nSignificantBits )
rational_ReduceInaccurate
(
value
,
nSignificantBits
);
rational_ReduceInaccurate
(
value
,
nSignificantBits
);
}
}
Fraction
::
Fraction
(
const
Fraction
&
rFrac
)
{
valid
=
rFrac
.
valid
;
if
(
valid
)
value
.
assign
(
rFrac
.
value
.
numerator
(),
rFrac
.
value
.
denominator
()
);
}
long
Fraction
::
GetNumerator
()
const
{
if
(
!
valid
)
{
SAL_WARN
(
"tools.fraction"
,
"'GetNumerator()' on invalid fraction"
);
return
0
;
}
return
value
.
numerator
();
}
long
Fraction
::
GetDenominator
()
const
{
if
(
!
valid
)
{
SAL_WARN
(
"tools.fraction"
,
"'GetDenominator()' on invalid fraction"
);
return
-
1
;
}
return
value
.
denominator
();
}
Fraction
&
Fraction
::
operator
=
(
const
Fraction
&
rFrac
)
{
if
(
this
!=
&
rFrac
)
{
valid
=
rFrac
.
valid
;
if
(
valid
)
value
.
assign
(
rFrac
.
value
.
numerator
(),
rFrac
.
value
.
denominator
()
);
}
return
*
this
;
}
bool
Fraction
::
IsValid
()
const
{
return
valid
;
}
Fraction
::
operator
long
()
const
{
if
(
!
valid
)
{
SAL_WARN
(
"tools.fraction"
,
"'operator long()' on invalid fraction"
);
return
0
;
}
return
boost
::
rational_cast
<
long
>
(
value
);
}
Fraction
operator
+
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
Fraction
aErg
(
rVal1
);
aErg
+=
rVal2
;
return
aErg
;
}
Fraction
operator
-
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
Fraction
aErg
(
rVal1
);
aErg
-=
rVal2
;
return
aErg
;
}
Fraction
operator
*
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
Fraction
aErg
(
rVal1
);
aErg
*=
rVal2
;
return
aErg
;
}
Fraction
operator
/
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
Fraction
aErg
(
rVal1
);
aErg
/=
rVal2
;
return
aErg
;
}
bool
operator
!=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
return
!
(
rVal1
==
rVal2
);
}
bool
operator
<=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
return
!
(
rVal1
>
rVal2
);
}
bool
operator
>=
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
return
!
(
rVal1
<
rVal2
);
}
bool
operator
==
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
bool
operator
==
(
const
Fraction
&
rVal1
,
const
Fraction
&
rVal2
)
{
{
if
(
!
rVal1
.
valid
||
!
rVal2
.
valid
)
{
if
(
!
rVal1
.
valid
||
!
rVal2
.
valid
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment