summaryrefslogtreecommitdiff
path: root/src/scaladoc/scala/tools/nsc/doc/model/Visibility.scala
blob: 22580805aa0157d8936fb6f02018d1f52a229bea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* NSC -- new Scala compiler
 * Copyright 2007-2013 LAMP/EPFL
 * @author  Gilles Dubochet
 */

package scala.tools.nsc
package doc
package model

/** An type that represents visibility of members. */
sealed trait Visibility {
  def isProtected: Boolean = false
  def isPublic: Boolean = false
}

/** The visibility of `private[this]` members. */
case class PrivateInInstance() extends Visibility

/** The visibility of `protected[this]` members. */
case class ProtectedInInstance() extends Visibility {
  override def isProtected = true
}

/** The visibility of `private[owner]` members. An unqualified private members
  * is encoded with `owner` equal to the members's `inTemplate`. */
case class PrivateInTemplate(owner: TemplateEntity) extends Visibility

/** The visibility of `protected[owner]` members. An unqualified protected
  * members is encoded with `owner` equal to the members's `inTemplate`.
  * Note that whilst the member is visible in any template owned by `owner`,
  * it is only visible in subclasses of the member's `inTemplate`. */
case class ProtectedInTemplate(owner: TemplateEntity) extends Visibility {
  override def isProtected = true
}

/** The visibility of public members. */
case class Public() extends Visibility {
  override def isPublic = true
}